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