-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.L-deprecatedLint: deprecatedLint: deprecatedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
Given the following two crates:
#![crate_name = "foo"]
pub struct Foo;
pub struct Bar;
pub trait IntoBar {
fn into_bar(self) -> Bar;
}
#[deprecated(note = "Just pass `Bar` instead")]
impl IntoBar for Foo {
fn into_bar(self) -> Bar {
Bar
}
}
extern crate foo;
use foo::*;
fn main() {
let _ = Foo.into_bar();
}
I would expect the second crate to see a deprecation warning on the use of Foo.into_bar()
. Instead, both crates compile successfully with no errors. I think that allowing deprecations on impls is a useful option to provide to authors (one that I was looking to do, and found this while seeing if it would work). However, if we do not wish to provide that ability to library authors, placing the #[deprecated]
attribute on an impl should result in a compiler error.
seanmonstar, gnzlbg, kostko, Robbepop, Hywan and 19 more
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.L-deprecatedLint: deprecatedLint: deprecatedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.