]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/auxiliary/lint_stability.rs
5e3cb606ce0371f258c77d2ec1576f398f29addd
[rust.git] / src / test / compile-fail / auxiliary / lint_stability.rs
1 // Copyright 2013 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 #![crate_name="lint_stability"]
11 #![crate_type = "lib"]
12 #![feature(staged_api)]
13 #![feature(associated_type_defaults)]
14 #![stable(feature = "lint_stability", since = "1.0.0")]
15
16 #[stable(feature = "test_feature", since = "1.0.0")]
17 #[rustc_deprecated(since = "1.0.0", reason = "text")]
18 pub fn deprecated() {}
19 #[stable(feature = "test_feature", since = "1.0.0")]
20 #[rustc_deprecated(since = "1.0.0", reason = "text")]
21 pub fn deprecated_text() {}
22
23 #[unstable(feature = "test_feature", issue = "0")]
24 #[rustc_deprecated(since = "1.0.0", reason = "text")]
25 pub fn deprecated_unstable() {}
26 #[unstable(feature = "test_feature", issue = "0")]
27 #[rustc_deprecated(since = "1.0.0", reason = "text")]
28 pub fn deprecated_unstable_text() {}
29
30 #[unstable(feature = "test_feature", issue = "0")]
31 pub fn unstable() {}
32 #[unstable(feature = "test_feature", reason = "text", issue = "0")]
33 pub fn unstable_text() {}
34
35 #[stable(feature = "rust1", since = "1.0.0")]
36 pub fn stable() {}
37 #[stable(feature = "rust1", since = "1.0.0")]
38 pub fn stable_text() {}
39
40 #[stable(feature = "rust1", since = "1.0.0")]
41 pub struct MethodTester;
42
43 impl MethodTester {
44     #[stable(feature = "test_feature", since = "1.0.0")]
45     #[rustc_deprecated(since = "1.0.0", reason = "text")]
46     pub fn method_deprecated(&self) {}
47     #[stable(feature = "test_feature", since = "1.0.0")]
48     #[rustc_deprecated(since = "1.0.0", reason = "text")]
49     pub fn method_deprecated_text(&self) {}
50
51     #[unstable(feature = "test_feature", issue = "0")]
52     #[rustc_deprecated(since = "1.0.0", reason = "text")]
53     pub fn method_deprecated_unstable(&self) {}
54     #[unstable(feature = "test_feature", issue = "0")]
55     #[rustc_deprecated(since = "1.0.0", reason = "text")]
56     pub fn method_deprecated_unstable_text(&self) {}
57
58     #[unstable(feature = "test_feature", issue = "0")]
59     pub fn method_unstable(&self) {}
60     #[unstable(feature = "test_feature", reason = "text", issue = "0")]
61     pub fn method_unstable_text(&self) {}
62
63     #[stable(feature = "rust1", since = "1.0.0")]
64     pub fn method_stable(&self) {}
65     #[stable(feature = "rust1", since = "1.0.0")]
66     pub fn method_stable_text(&self) {}
67 }
68
69 #[stable(feature = "test_feature", since = "1.0.0")]
70 pub trait Trait {
71     #[stable(feature = "test_feature", since = "1.0.0")]
72     #[rustc_deprecated(since = "1.0.0", reason = "text")]
73     fn trait_deprecated(&self) {}
74     #[stable(feature = "test_feature", since = "1.0.0")]
75     #[rustc_deprecated(since = "1.0.0", reason = "text")]
76     fn trait_deprecated_text(&self) {}
77
78     #[unstable(feature = "test_feature", issue = "0")]
79     #[rustc_deprecated(since = "1.0.0", reason = "text")]
80     fn trait_deprecated_unstable(&self) {}
81     #[unstable(feature = "test_feature", issue = "0")]
82     #[rustc_deprecated(since = "1.0.0", reason = "text")]
83     fn trait_deprecated_unstable_text(&self) {}
84
85     #[unstable(feature = "test_feature", issue = "0")]
86     fn trait_unstable(&self) {}
87     #[unstable(feature = "test_feature", reason = "text", issue = "0")]
88     fn trait_unstable_text(&self) {}
89
90     #[stable(feature = "rust1", since = "1.0.0")]
91     fn trait_stable(&self) {}
92     #[stable(feature = "rust1", since = "1.0.0")]
93     fn trait_stable_text(&self) {}
94 }
95
96 #[stable(feature = "test_feature", since = "1.0.0")]
97 pub trait TraitWithAssociatedTypes {
98     #[unstable(feature = "test_feature", issue = "0")]
99     type TypeUnstable = u8;
100     #[stable(feature = "test_feature", since = "1.0.0")]
101     #[rustc_deprecated(since = "1.0.0", reason = "text")]
102     type TypeDeprecated = u8;
103 }
104
105 #[stable(feature = "test_feature", since = "1.0.0")]
106 impl Trait for MethodTester {}
107
108 #[unstable(feature = "test_feature", issue = "0")]
109 pub trait UnstableTrait { fn dummy(&self) { } }
110
111 #[stable(feature = "test_feature", since = "1.0.0")]
112 #[rustc_deprecated(since = "1.0.0", reason = "text")]
113 pub trait DeprecatedTrait {
114     #[stable(feature = "test_feature", since = "1.0.0")] fn dummy(&self) { }
115 }
116
117 #[stable(feature = "test_feature", since = "1.0.0")]
118 #[rustc_deprecated(since = "1.0.0", reason = "text")]
119 pub struct DeprecatedStruct {
120     #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
121 }
122 #[unstable(feature = "test_feature", issue = "0")]
123 #[rustc_deprecated(since = "1.0.0", reason = "text")]
124 pub struct DeprecatedUnstableStruct {
125     #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
126 }
127 #[unstable(feature = "test_feature", issue = "0")]
128 pub struct UnstableStruct {
129     #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
130 }
131 #[stable(feature = "rust1", since = "1.0.0")]
132 pub struct StableStruct {
133     #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
134 }
135 #[unstable(feature = "test_feature", issue = "0")]
136 pub enum UnstableEnum {}
137 #[stable(feature = "rust1", since = "1.0.0")]
138 pub enum StableEnum {}
139
140 #[stable(feature = "test_feature", since = "1.0.0")]
141 #[rustc_deprecated(since = "1.0.0", reason = "text")]
142 pub struct DeprecatedUnitStruct;
143 #[unstable(feature = "test_feature", issue = "0")]
144 #[rustc_deprecated(since = "1.0.0", reason = "text")]
145 pub struct DeprecatedUnstableUnitStruct;
146 #[unstable(feature = "test_feature", issue = "0")]
147 pub struct UnstableUnitStruct;
148 #[stable(feature = "rust1", since = "1.0.0")]
149 pub struct StableUnitStruct;
150
151 #[stable(feature = "test_feature", since = "1.0.0")]
152 pub enum Enum {
153     #[stable(feature = "test_feature", since = "1.0.0")]
154     #[rustc_deprecated(since = "1.0.0", reason = "text")]
155     DeprecatedVariant,
156     #[unstable(feature = "test_feature", issue = "0")]
157     #[rustc_deprecated(since = "1.0.0", reason = "text")]
158     DeprecatedUnstableVariant,
159     #[unstable(feature = "test_feature", issue = "0")]
160     UnstableVariant,
161
162     #[stable(feature = "rust1", since = "1.0.0")]
163     StableVariant,
164 }
165
166 #[stable(feature = "test_feature", since = "1.0.0")]
167 #[rustc_deprecated(since = "1.0.0", reason = "text")]
168 pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
169 #[unstable(feature = "test_feature", issue = "0")]
170 #[rustc_deprecated(since = "1.0.0", reason = "text")]
171 pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
172 #[unstable(feature = "test_feature", issue = "0")]
173 pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
174 #[stable(feature = "rust1", since = "1.0.0")]
175 pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
176
177 #[stable(feature = "test_feature", since = "1.0.0")]
178 #[macro_export]
179 macro_rules! macro_test {
180     () => (deprecated());
181 }
182
183 #[stable(feature = "test_feature", since = "1.0.0")]
184 #[macro_export]
185 macro_rules! macro_test_arg {
186     ($func:expr) => ($func);
187 }
188
189 #[stable(feature = "test_feature", since = "1.0.0")]
190 #[macro_export]
191 macro_rules! macro_test_arg_nested {
192     ($func:ident) => (macro_test_arg!($func()));
193 }