]> git.lizzy.rs Git - rust.git/blob - src/test/ui/stability-attribute/stability-attribute-sanity.rs
Merge commit '03f01bbe901d60b71cf2c5ec766aef5e532ab79d' into update_cg_clif-2020...
[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(const_fn, 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     #[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542]
41     fn f2() { }
42
43     #[stable(feature = "a", since = "b")]
44     #[rustc_deprecated(since = "a")] //~ ERROR missing 'reason' [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")]
61 #[rustc_deprecated(since = "b", reason = "text")]
62 #[rustc_deprecated(since = "b", reason = "text")]
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() { } //~ ERROR multiple deprecated attributes
66 //~^ ERROR Invalid stability or deprecation version found
67
68 #[rustc_deprecated(since = "a", reason = "text")]
69 fn deprecated_without_unstable_or_stable() { }
70 //~^ ERROR rustc_deprecated attribute must be paired with either stable or unstable attribute
71
72 fn main() { }