]> git.lizzy.rs Git - rust.git/blob - tests/ui/deprecation/suggestion.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / deprecation / suggestion.rs
1 // run-rustfix
2
3 #![feature(staged_api)]
4 #![feature(deprecated_suggestion)]
5
6 #![stable(since = "1.0.0", feature = "test")]
7
8 #![deny(deprecated)]
9 #![allow(dead_code)]
10
11 struct Foo;
12
13 impl Foo {
14     #[deprecated(
15         since = "1.0.0",
16         note = "replaced by `replacement`",
17         suggestion = "replacement",
18     )]
19     #[stable(since = "1.0.0", feature = "test")]
20     fn deprecated(&self) {}
21
22     fn replacement(&self) {}
23 }
24
25 mod bar {
26     #[deprecated(
27     since = "1.0.0",
28     note = "replaced by `replacement`",
29     suggestion = "replacement",
30     )]
31     #[stable(since = "1.0.0", feature = "test")]
32     pub fn deprecated() {}
33
34     pub fn replacement() {}
35 }
36
37 fn main() {
38     let foo = Foo;
39
40     foo.deprecated(); //~ ERROR use of deprecated
41
42     bar::deprecated(); //~ ERROR use of deprecated
43 }