Skip to content

No deprecation warning for method call on deprecated type alias #31848

Closed
@bluss

Description

@bluss

The following should emit a deprecation warning (feature(deprecated))

#![feature(deprecated)]
pub mod lib {
    #[deprecated(note="don't use this")]
    pub type Foo = String;
}

fn main() {
    let t = ::lib::Foo::new(); // no warning
    println!("{}", t);
}

Type aliases can emit warnings, like in the following example, but I think it should warn as the use site too (marked "no warning"):

#![feature(deprecated)]
pub mod lib {
    #[deprecated(note="don't use this")]
    pub type Foo = String;
}

use lib::Foo; // WARNING use of deprecated item

fn main() {
    let s = Foo::new(); // no warning
    println!("{}", s);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-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