]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/stability-attribute-sanity.rs
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(staged_api)]
16 mod bogus_attribute_types_1
{
17 #[stable(feature = "a", since = "a", reason)] //~ ERROR unknown meta item 'reason'
20 #[stable(feature = "a", since)] //~ ERROR incorrect meta item
23 #[stable(feature, since = "a")] //~ ERROR incorrect meta item
26 #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item
29 #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item
33 mod bogus_attribute_types_2
{
34 #[unstable] //~ ERROR incorrect stability attribute type
37 #[unstable = "a"] //~ ERROR incorrect stability attribute type
40 #[stable] //~ ERROR incorrect stability attribute type
43 #[stable = "a"] //~ ERROR incorrect stability attribute type
46 #[stable(feature = "a", since = "b")]
47 #[deprecated] //~ ERROR incorrect stability attribute type
50 #[stable(feature = "a", since = "b")]
51 #[deprecated = "a"] //~ ERROR incorrect stability attribute type
55 mod missing_feature_names
{
56 #[unstable(issue = "0")] //~ ERROR missing 'feature'
59 #[unstable(feature = "a")] //~ ERROR missing 'issue'
62 #[stable(since = "a")] //~ ERROR missing 'feature'
67 #[stable(feature = "a")] //~ ERROR missing 'since'
70 #[stable(feature = "a", since = "b")]
71 #[deprecated(reason = "a")] //~ ERROR missing 'since'
75 #[unstable(feature = "a", issue = "0")]
76 #[stable(feature = "a", since = "b")]
77 fn multiple1() { }
//~ ERROR multiple stability levels
79 #[unstable(feature = "a", issue = "0")]
80 #[unstable(feature = "a", issue = "0")]
81 fn multiple2() { }
//~ ERROR multiple stability levels
83 #[stable(feature = "a", since = "b")]
84 #[stable(feature = "a", since = "b")]
85 fn multiple3() { }
//~ ERROR multiple stability levels
87 #[stable(feature = "a", since = "b")]
88 #[deprecated(since = "b", reason = "text")]
89 #[deprecated(since = "b", reason = "text")]
90 fn multiple4() { }
//~ ERROR multiple deprecated attributes
91 //~^ ERROR Invalid stability or deprecation version found
93 #[deprecated(since = "a", reason = "text")]
94 fn deprecated_without_unstable_or_stable() { }
//~ ERROR deprecated attribute must be paired