Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bluss opened this issue Feb 23, 2016 · 3 comments
Closed

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

bluss opened this issue Feb 23, 2016 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bluss
Copy link
Member

bluss commented Feb 23, 2016

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);
}
@bluss
Copy link
Member Author

bluss commented Feb 23, 2016

cc @petrochenkov

@petrochenkov
Copy link
Contributor

This is probably caused by the same reasons as #30209

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Mar 11, 2016
@steveklabnik steveklabnik added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum
Copy link
Member

Closing.

warning: use of deprecated item: don't use this
 --> test.rs:7:13
  |
7 |     let t = ::lib::Foo::new(); // no warning
  |             ^^^^^^^^^^^^^^^
  |
  = note: #[warn(deprecated)] on by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants