]> git.lizzy.rs Git - rust.git/blob - src/test/ui/deprecation/deprecation-lint-nested.rs
ee6f0a22363f928b3b581429109294efcc83b95f
[rust.git] / src / test / ui / deprecation / deprecation-lint-nested.rs
1 #![deny(deprecated)]
2 #![allow(warnings)]
3
4 #[deprecated]
5 fn issue_35128() {
6     format_args!("foo");
7 }
8
9 #[deprecated]
10 fn issue_35128_minimal() {
11     static FOO: &'static str = "foo";
12     let _ = FOO;
13 }
14
15 #[deprecated]
16 mod silent {
17     type DeprecatedType = u8;
18     struct DeprecatedStruct;
19     fn deprecated_fn() {}
20     trait DeprecatedTrait {}
21     static DEPRECATED_STATIC: u8 = 0;
22     const DEPRECATED_CONST: u8 = 1;
23
24     struct Foo(DeprecatedType);
25
26     impl DeprecatedTrait for Foo {}
27
28     impl Foo {
29         fn bar<T: DeprecatedTrait>() {
30             deprecated_fn();
31         }
32     }
33
34     fn foo() -> u8 {
35         DEPRECATED_STATIC +
36         DEPRECATED_CONST
37     }
38 }
39
40 #[deprecated]
41 mod loud {
42     #[deprecated]
43     type DeprecatedType = u8;
44     #[deprecated]
45     struct DeprecatedStruct;
46     #[deprecated]
47     fn deprecated_fn() {}
48     #[deprecated]
49     trait DeprecatedTrait {}
50     #[deprecated]
51     static DEPRECATED_STATIC: u8 = 0;
52     #[deprecated]
53     const DEPRECATED_CONST: u8 = 1;
54
55     struct Foo(DeprecatedType); //~ ERROR use of deprecated item
56
57     impl DeprecatedTrait for Foo {} //~ ERROR use of deprecated item
58
59     impl Foo {
60         fn bar<T: DeprecatedTrait>() { //~ ERROR use of deprecated item
61             deprecated_fn(); //~ ERROR use of deprecated item
62         }
63     }
64
65     fn foo() -> u8 {
66         DEPRECATED_STATIC + //~ ERROR use of deprecated item
67         DEPRECATED_CONST //~ ERROR use of deprecated item
68     }
69 }
70
71 fn main() {}