]>
Commit | Line | Data |
---|---|---|
85aaf69f SL |
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. | |
4 | // | |
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. | |
10 | ||
11 | // Various checks that stability attributes are used correctly, per RFC 507 | |
12 | ||
13 | #![feature(staged_api)] | |
14 | #![staged_api] | |
15 | ||
16 | mod bogus_attribute_types_1 { | |
17 | #[stable(feature = "a", since = "a", reason)] //~ ERROR incorrect meta item | |
18 | fn f1() { } | |
19 | ||
20 | #[stable(feature = "a", since, reason = "a")] //~ ERROR incorrect meta item | |
21 | fn f2() { } | |
22 | ||
23 | #[stable(feature, since = "a", reason = "a")] //~ ERROR incorrect meta item | |
24 | fn f3() { } | |
25 | ||
26 | #[stable(feature = "a", since = "a", reason(b))] //~ ERROR incorrect meta item | |
27 | fn f4() { } | |
28 | ||
29 | #[stable(feature = "a", since(b), reason = "a")] //~ ERROR incorrect meta item | |
30 | fn f5() { } | |
31 | ||
32 | #[stable(feature(b), since = "a", reason = "a")] //~ ERROR incorrect meta item | |
33 | fn f6() { } | |
34 | } | |
35 | ||
36 | mod bogus_attribute_types_2 { | |
37 | #[unstable] //~ ERROR incorrect stability attribute type | |
38 | fn f1() { } | |
39 | ||
40 | #[unstable = "a"] //~ ERROR incorrect stability attribute type | |
41 | fn f2() { } | |
42 | ||
43 | #[stable] //~ ERROR incorrect stability attribute type | |
44 | fn f3() { } | |
45 | ||
46 | #[stable = "a"] //~ ERROR incorrect stability attribute type | |
47 | fn f4() { } | |
48 | ||
49 | #[stable(feature = "a", since = "b")] | |
50 | #[deprecated] //~ ERROR incorrect stability attribute type | |
51 | fn f5() { } | |
52 | ||
53 | #[stable(feature = "a", since = "b")] | |
54 | #[deprecated = "a"] //~ ERROR incorrect stability attribute type | |
55 | fn f6() { } | |
56 | } | |
57 | ||
58 | mod missing_feature_names { | |
59 | #[unstable(since = "a")] //~ ERROR missing 'feature' | |
60 | fn f1() { } | |
61 | ||
62 | #[stable(since = "a")] //~ ERROR missing 'feature' | |
63 | fn f2() { } | |
64 | } | |
65 | ||
66 | mod missing_version { | |
67 | #[stable(feature = "a")] //~ ERROR missing 'since' | |
68 | fn f1() { } | |
69 | ||
70 | #[stable(feature = "a", since = "b")] | |
71 | #[deprecated(reason = "a")] //~ ERROR missing 'since' | |
72 | fn f2() { } | |
73 | } | |
74 | ||
75 | #[unstable(feature = "a", since = "b")] | |
76 | #[stable(feature = "a", since = "b")] | |
77 | fn multiple1() { } //~ ERROR multiple stability levels | |
78 | ||
79 | #[unstable(feature = "a", since = "b")] | |
80 | #[unstable(feature = "a", since = "b")] | |
81 | fn multiple2() { } //~ ERROR multiple stability levels | |
82 | ||
83 | #[stable(feature = "a", since = "b")] | |
84 | #[stable(feature = "a", since = "b")] | |
85 | fn multiple3() { } //~ ERROR multiple stability levels | |
86 | ||
87 | #[stable(feature = "a", since = "b")] | |
88 | #[deprecated(since = "b")] | |
89 | #[deprecated(since = "b")] | |
90 | fn multiple4() { } //~ ERROR multiple deprecated attributes | |
c1a9b12d | 91 | //~^ ERROR Invalid stability or deprecation version found |
85aaf69f SL |
92 | |
93 | #[deprecated(since = "a")] | |
94 | fn deprecated_without_unstable_or_stable() { } //~ ERROR deprecated attribute must be paired | |
95 | ||
96 | fn main() { } |