- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.Category: This is a bug.T-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.
Description
When since > version of rustc and patch is in the version then deprecated is ignored:
My expectation is that: since is referring to the version of my crate, not the rustc version.
struct Bar {}
impl Bar {
    #[deprecated(since = "1.32.0")]
    fn patch_works(&self) -> () { () }
    
    #[deprecated(since = "1.33.0")]
    fn patch_ignored1(&self) -> () { () }
    
    #[deprecated(since = "2.1.0")]
    fn patch_ignored2(&self) -> () { () }
    
    #[deprecated(since = "2.0")]
    fn minor_works(&self) -> () { () }
}
fn main() {
    let bar = Bar { };
    bar.patch_works();
    bar.patch_ignored1();
    bar.patch_ignored2();
    bar.minor_works();
}The docs say:
since expects a version number, as in #[deprecated(since = "1.4.1")]
rustc doesn't know anything about versions, but external tools like clippy may check the validity of this field.
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.Category: This is a bug.T-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.