1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Various checks that stability attributes are used correctly, per RFC 507
13 #![feature(const_fn, staged_api, rustc_const_unstable)]
15 #![stable(feature = "rust1", since = "1.0.0")]
17 mod bogus_attribute_types_1 {
18 #[stable(feature = "a", since = "a", reason)] //~ ERROR unknown meta item 'reason' [E0541]
21 #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
24 #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539]
27 #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539]
30 #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539]
34 mod bogus_attribute_types_2 {
35 #[unstable] //~ ERROR incorrect stability attribute type [E0548]
38 #[unstable = "a"] //~ ERROR incorrect stability attribute type [E0548]
41 #[stable] //~ ERROR incorrect stability attribute type [E0548]
44 #[stable = "a"] //~ ERROR incorrect stability attribute type [E0548]
47 #[stable(feature = "a", since = "b")]
48 #[rustc_deprecated] //~ ERROR incorrect stability attribute type [E0548]
51 #[stable(feature = "a", since = "b")]
52 #[rustc_deprecated = "a"] //~ ERROR incorrect stability attribute type [E0548]
56 mod missing_feature_names {
57 #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546]
60 #[unstable(feature = "a")] //~ ERROR missing 'issue' [E0547]
63 #[stable(since = "a")] //~ ERROR missing 'feature' [E0546]
68 #[stable(feature = "a")] //~ ERROR missing 'since' [E0542]
71 #[stable(feature = "a", since = "b")]
72 #[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542]
76 #[unstable(feature = "a", issue = "0")]
77 #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
80 #[unstable(feature = "a", issue = "0")]
81 #[unstable(feature = "a", issue = "0")] //~ ERROR multiple stability levels [E0544]
84 #[stable(feature = "a", since = "b")]
85 #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
88 #[stable(feature = "a", since = "b")]
89 #[rustc_deprecated(since = "b", reason = "text")]
90 #[rustc_deprecated(since = "b", reason = "text")]
91 #[rustc_const_unstable(feature = "a")]
92 #[rustc_const_unstable(feature = "b")]
93 pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540]
94 //~^ ERROR Invalid stability or deprecation version found
95 //~| ERROR multiple rustc_const_unstable attributes
97 #[rustc_deprecated(since = "a", reason = "text")]
98 fn deprecated_without_unstable_or_stable() { }
99 //~^ ERROR rustc_deprecated attribute must be paired with either stable or unstable attribute