rust/tests/ui/deprecation/suggestion.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
802 B
Rust
Raw Normal View History

// run-rustfix
#![feature(staged_api)]
#![feature(deprecated_suggestion)]
#![stable(since = "1.0.0", feature = "test")]
#![deny(deprecated)]
#![allow(dead_code)]
struct Foo;
impl Foo {
2022-03-04 21:59:18 -05:00
#[deprecated(
since = "1.0.0",
2022-03-04 21:59:18 -05:00
note = "replaced by `replacement`",
suggestion = "replacement",
)]
#[stable(since = "1.0.0", feature = "test")]
fn deprecated(&self) {}
fn replacement(&self) {}
}
2021-06-15 16:21:58 +08:00
mod bar {
2022-03-04 21:59:18 -05:00
#[deprecated(
2021-06-15 16:21:58 +08:00
since = "1.0.0",
2022-03-04 21:59:18 -05:00
note = "replaced by `replacement`",
2021-06-15 16:21:58 +08:00
suggestion = "replacement",
)]
#[stable(since = "1.0.0", feature = "test")]
pub fn deprecated() {}
pub fn replacement() {}
}
fn main() {
let foo = Foo;
2021-05-24 11:41:39 +08:00
foo.deprecated(); //~ ERROR use of deprecated
2021-06-15 16:21:58 +08:00
bar::deprecated(); //~ ERROR use of deprecated
}