]> git.lizzy.rs Git - rust.git/blob - src/test/ui/deprecation/deprecation-sanity.rs
Cache expansion hash.
[rust.git] / src / test / ui / deprecation / deprecation-sanity.rs
1 // Various checks that deprecation attributes are used correctly
2
3 mod bogus_attribute_types_1 {
4     #[deprecated(since = "a", note = "a", reason)] //~ ERROR unknown meta item 'reason'
5     fn f1() { }
6
7     #[deprecated(since = "a", note)] //~ ERROR incorrect meta item
8     fn f2() { }
9
10     #[deprecated(since, note = "a")] //~ ERROR incorrect meta item
11     fn f3() { }
12
13     #[deprecated(since = "a", note(b))] //~ ERROR incorrect meta item
14     fn f5() { }
15
16     #[deprecated(since(b), note = "a")] //~ ERROR incorrect meta item
17     fn f6() { }
18
19     #[deprecated(note = b"test")] //~ ERROR literal in `deprecated` value must be a string
20     fn f7() { }
21
22     #[deprecated("test")] //~ ERROR item in `deprecated` must be a key/value pair
23     fn f8() { }
24 }
25
26 #[deprecated(since = "a", note = "b")]
27 #[deprecated(since = "a", note = "b")] //~ ERROR multiple deprecated attributes
28 fn multiple1() { }
29
30 #[deprecated(since = "a", since = "b", note = "c")] //~ ERROR multiple 'since' items
31 fn f1() { }
32
33 struct X;
34
35 #[deprecated = "hello"] //~ ERROR this `#[deprecated]` annotation has no effect
36 impl Default for X {
37     fn default() -> Self {
38         X
39     }
40 }
41
42 fn main() { }