]> git.lizzy.rs Git - rust.git/blob - src/test/ui/stability-attribute/stability-attribute-sanity.rs
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
[rust.git] / src / test / ui / stability-attribute / stability-attribute-sanity.rs
1 // Various checks that stability attributes are used correctly, per RFC 507
2
3 #![feature(staged_api)]
4
5 #![stable(feature = "rust1", since = "1.0.0")]
6
7 mod bogus_attribute_types_1 {
8     #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541]
9     fn f1() { }
10
11     #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
12     fn f2() { }
13
14     #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539]
15     fn f3() { }
16
17     #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539]
18     fn f5() { }
19
20     #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539]
21     fn f6() { }
22 }
23
24 mod missing_feature_names {
25     #[unstable(issue = "none")] //~ ERROR missing 'feature' [E0546]
26     fn f1() { }
27
28     #[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547]
29     fn f2() { }
30
31     #[stable(since = "a")] //~ ERROR missing 'feature' [E0546]
32     fn f3() { }
33 }
34
35 mod missing_version {
36     #[stable(feature = "a")] //~ ERROR missing 'since' [E0542]
37     fn f1() { }
38
39     #[stable(feature = "a", since = "b")]
40     #[deprecated(note = "a")] //~ ERROR missing 'since' [E0542]
41     fn f2() { }
42
43     #[stable(feature = "a", since = "b")]
44     #[deprecated(since = "a")] //~ ERROR missing 'note' [E0543]
45     fn f3() { }
46 }
47
48 #[unstable(feature = "b", issue = "none")]
49 #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
50 fn multiple1() { }
51
52 #[unstable(feature = "b", issue = "none")]
53 #[unstable(feature = "b", issue = "none")] //~ ERROR multiple stability levels [E0544]
54 fn multiple2() { }
55
56 #[stable(feature = "a", since = "b")]
57 #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
58 fn multiple3() { }
59
60 #[stable(feature = "a", since = "b")] //~ ERROR invalid stability version found
61 #[deprecated(since = "b", note = "text")]
62 #[deprecated(since = "b", note = "text")] //~ ERROR multiple `deprecated` attributes
63 #[rustc_const_unstable(feature = "c", issue = "none")]
64 #[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels
65 pub const fn multiple4() { }
66
67 #[stable(feature = "a", since = "1.0.0")] //~ ERROR invalid deprecation version found
68 //~^ ERROR feature `a` is declared stable since 1.0.0
69 #[deprecated(since = "invalid", note = "text")]
70 fn invalid_deprecation_version() {}
71
72 #[deprecated(since = "a", note = "text")]
73 fn deprecated_without_unstable_or_stable() { }
74 //~^^ ERROR deprecated attribute must be paired with either stable or unstable attribute
75
76 fn main() { }