Skip to content

Deprecated ignored if since > rust version and has patch #57952

Closed
@ascjones

Description

@ascjones

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();
}

(Playground)

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

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions