]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2013-2014 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 | // aux-build:lint_stability.rs | |
12 | // aux-build:inherited_stability.rs | |
13 | // aux-build:stability_cfg1.rs | |
14 | // aux-build:stability_cfg2.rs | |
15 | ||
1a4d82fc | 16 | #![deny(deprecated)] |
1a4d82fc | 17 | #![allow(dead_code)] |
85aaf69f | 18 | #![feature(staged_api)] |
1a4d82fc JJ |
19 | #![staged_api] |
20 | ||
21 | #[macro_use] | |
85aaf69f | 22 | extern crate lint_stability; |
1a4d82fc JJ |
23 | |
24 | mod cross_crate { | |
25 | extern crate stability_cfg1; | |
c34b1796 | 26 | extern crate stability_cfg2; //~ ERROR use of unstable library feature |
1a4d82fc JJ |
27 | |
28 | use lint_stability::*; | |
29 | ||
30 | fn test() { | |
c34b1796 | 31 | type Foo = MethodTester; |
1a4d82fc JJ |
32 | let foo = MethodTester; |
33 | ||
34 | deprecated(); //~ ERROR use of deprecated item | |
35 | foo.method_deprecated(); //~ ERROR use of deprecated item | |
c34b1796 AL |
36 | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item |
37 | <Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item | |
1a4d82fc | 38 | foo.trait_deprecated(); //~ ERROR use of deprecated item |
c34b1796 AL |
39 | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item |
40 | <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item | |
41 | <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item | |
1a4d82fc JJ |
42 | |
43 | deprecated_text(); //~ ERROR use of deprecated item: text | |
44 | foo.method_deprecated_text(); //~ ERROR use of deprecated item: text | |
c34b1796 AL |
45 | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text |
46 | <Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
1a4d82fc | 47 | foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text |
c34b1796 AL |
48 | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text |
49 | <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
50 | <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
1a4d82fc | 51 | |
85aaf69f | 52 | deprecated_unstable(); //~ ERROR use of deprecated item |
c34b1796 | 53 | //~^ ERROR use of unstable library feature |
85aaf69f | 54 | foo.method_deprecated_unstable(); //~ ERROR use of deprecated item |
c34b1796 AL |
55 | //~^ ERROR use of unstable library feature |
56 | Foo::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item | |
57 | //~^ ERROR use of unstable library feature | |
58 | <Foo>::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item | |
59 | //~^ ERROR use of unstable library feature | |
85aaf69f | 60 | foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item |
c34b1796 AL |
61 | //~^ ERROR use of unstable library feature |
62 | Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item | |
63 | //~^ ERROR use of unstable library feature | |
64 | <Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item | |
65 | //~^ ERROR use of unstable library feature | |
66 | <Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item | |
67 | //~^ ERROR use of unstable library feature | |
1a4d82fc | 68 | |
85aaf69f | 69 | deprecated_unstable_text(); //~ ERROR use of deprecated item: text |
c34b1796 | 70 | //~^ ERROR use of unstable library feature |
85aaf69f | 71 | foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text |
c34b1796 AL |
72 | //~^ ERROR use of unstable library feature |
73 | Foo::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text | |
74 | //~^ ERROR use of unstable library feature | |
75 | <Foo>::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text | |
76 | //~^ ERROR use of unstable library feature | |
85aaf69f | 77 | foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text |
c34b1796 AL |
78 | //~^ ERROR use of unstable library feature |
79 | Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text | |
80 | //~^ ERROR use of unstable library feature | |
81 | <Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text | |
82 | //~^ ERROR use of unstable library feature | |
83 | <Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text | |
84 | //~^ ERROR use of unstable library feature | |
85 | ||
86 | unstable(); //~ ERROR use of unstable library feature | |
87 | foo.method_unstable(); //~ ERROR use of unstable library feature | |
88 | Foo::method_unstable(&foo); //~ ERROR use of unstable library feature | |
89 | <Foo>::method_unstable(&foo); //~ ERROR use of unstable library feature | |
90 | foo.trait_unstable(); //~ ERROR use of unstable library feature | |
91 | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature | |
92 | <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature | |
93 | <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature | |
1a4d82fc | 94 | |
c34b1796 AL |
95 | unstable_text(); |
96 | //~^ ERROR use of unstable library feature 'test_feature': text | |
97 | foo.method_unstable_text(); | |
98 | //~^ ERROR use of unstable library feature 'test_feature': text | |
99 | Foo::method_unstable_text(&foo); | |
100 | //~^ ERROR use of unstable library feature 'test_feature': text | |
101 | <Foo>::method_unstable_text(&foo); | |
102 | //~^ ERROR use of unstable library feature 'test_feature': text | |
103 | foo.trait_unstable_text(); | |
104 | //~^ ERROR use of unstable library feature 'test_feature': text | |
105 | Trait::trait_unstable_text(&foo); | |
106 | //~^ ERROR use of unstable library feature 'test_feature': text | |
107 | <Foo>::trait_unstable_text(&foo); | |
108 | //~^ ERROR use of unstable library feature 'test_feature': text | |
109 | <Foo as Trait>::trait_unstable_text(&foo); | |
110 | //~^ ERROR use of unstable library feature 'test_feature': text | |
1a4d82fc JJ |
111 | |
112 | stable(); | |
113 | foo.method_stable(); | |
c34b1796 AL |
114 | Foo::method_stable(&foo); |
115 | <Foo>::method_stable(&foo); | |
1a4d82fc | 116 | foo.trait_stable(); |
c34b1796 AL |
117 | Trait::trait_stable(&foo); |
118 | <Foo>::trait_stable(&foo); | |
119 | <Foo as Trait>::trait_stable(&foo); | |
1a4d82fc JJ |
120 | |
121 | stable_text(); | |
122 | foo.method_stable_text(); | |
c34b1796 AL |
123 | Foo::method_stable_text(&foo); |
124 | <Foo>::method_stable_text(&foo); | |
1a4d82fc | 125 | foo.trait_stable_text(); |
c34b1796 AL |
126 | Trait::trait_stable_text(&foo); |
127 | <Foo>::trait_stable_text(&foo); | |
128 | <Foo as Trait>::trait_stable_text(&foo); | |
1a4d82fc | 129 | |
1a4d82fc | 130 | let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item |
85aaf69f | 131 | let _ = DeprecatedUnstableStruct { i: 0 }; //~ ERROR use of deprecated item |
c34b1796 AL |
132 | //~^ ERROR use of unstable library feature |
133 | let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library feature | |
1a4d82fc | 134 | let _ = StableStruct { i: 0 }; |
1a4d82fc JJ |
135 | |
136 | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item | |
85aaf69f | 137 | let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item |
c34b1796 AL |
138 | //~^ ERROR use of unstable library feature |
139 | let _ = UnstableUnitStruct; //~ ERROR use of unstable library feature | |
1a4d82fc | 140 | let _ = StableUnitStruct; |
1a4d82fc JJ |
141 | |
142 | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item | |
85aaf69f | 143 | let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item |
c34b1796 AL |
144 | //~^ ERROR use of unstable library feature |
145 | let _ = Enum::UnstableVariant; //~ ERROR use of unstable library feature | |
1a4d82fc | 146 | let _ = Enum::StableVariant; |
1a4d82fc JJ |
147 | |
148 | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item | |
85aaf69f | 149 | let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item |
c34b1796 AL |
150 | //~^ ERROR use of unstable library feature |
151 | let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library feature | |
1a4d82fc | 152 | let _ = StableTupleStruct (1); |
1a4d82fc JJ |
153 | |
154 | // At the moment, the lint checker only checks stability in | |
155 | // in the arguments of macros. | |
156 | // Eventually, we will want to lint the contents of the | |
157 | // macro in the module *defining* it. Also, stability levels | |
158 | // on macros themselves are not yet linted. | |
1a4d82fc | 159 | macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text |
85aaf69f | 160 | macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text |
c34b1796 | 161 | //~^ ERROR use of unstable library feature |
1a4d82fc | 162 | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text |
1a4d82fc JJ |
163 | } |
164 | ||
c34b1796 | 165 | fn test_method_param<Foo: Trait>(foo: Foo) { |
1a4d82fc | 166 | foo.trait_deprecated(); //~ ERROR use of deprecated item |
c34b1796 AL |
167 | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item |
168 | <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item | |
169 | <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item | |
1a4d82fc | 170 | foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text |
c34b1796 AL |
171 | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text |
172 | <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
173 | <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
85aaf69f | 174 | foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item |
c34b1796 AL |
175 | //~^ ERROR use of unstable library feature |
176 | Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item | |
177 | //~^ ERROR use of unstable library feature | |
178 | <Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item | |
179 | //~^ ERROR use of unstable library feature | |
180 | <Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item | |
181 | //~^ ERROR use of unstable library feature | |
85aaf69f | 182 | foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text |
c34b1796 AL |
183 | //~^ ERROR use of unstable library feature |
184 | Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text | |
185 | //~^ ERROR use of unstable library feature | |
186 | <Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text | |
187 | //~^ ERROR use of unstable library feature | |
188 | <Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text | |
189 | //~^ ERROR use of unstable library feature | |
190 | foo.trait_unstable(); //~ ERROR use of unstable library feature | |
191 | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature | |
192 | <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature | |
193 | <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature | |
194 | foo.trait_unstable_text(); | |
195 | //~^ ERROR use of unstable library feature 'test_feature': text | |
196 | Trait::trait_unstable_text(&foo); | |
197 | //~^ ERROR use of unstable library feature 'test_feature': text | |
198 | <Foo>::trait_unstable_text(&foo); | |
199 | //~^ ERROR use of unstable library feature 'test_feature': text | |
200 | <Foo as Trait>::trait_unstable_text(&foo); | |
201 | //~^ ERROR use of unstable library feature 'test_feature': text | |
1a4d82fc | 202 | foo.trait_stable(); |
c34b1796 AL |
203 | Trait::trait_stable(&foo); |
204 | <Foo>::trait_stable(&foo); | |
205 | <Foo as Trait>::trait_stable(&foo); | |
1a4d82fc JJ |
206 | } |
207 | ||
208 | fn test_method_object(foo: &Trait) { | |
209 | foo.trait_deprecated(); //~ ERROR use of deprecated item | |
210 | foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text | |
85aaf69f | 211 | foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item |
c34b1796 | 212 | //~^ ERROR use of unstable library feature |
85aaf69f | 213 | foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text |
c34b1796 AL |
214 | //~^ ERROR use of unstable library feature |
215 | foo.trait_unstable(); //~ ERROR use of unstable library feature | |
216 | foo.trait_unstable_text(); | |
217 | //~^ ERROR use of unstable library feature 'test_feature': text | |
1a4d82fc JJ |
218 | foo.trait_stable(); |
219 | } | |
220 | ||
221 | struct S; | |
222 | ||
c34b1796 | 223 | impl UnstableTrait for S { } //~ ERROR use of unstable library feature |
85aaf69f | 224 | |
c34b1796 | 225 | trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library feature |
1a4d82fc | 226 | |
85aaf69f SL |
227 | impl Trait for S { |
228 | fn trait_stable(&self) {} | |
c34b1796 | 229 | fn trait_unstable(&self) {} //~ ERROR use of unstable library feature |
85aaf69f | 230 | } |
1a4d82fc JJ |
231 | } |
232 | ||
233 | mod inheritance { | |
c34b1796 AL |
234 | extern crate inherited_stability; //~ ERROR use of unstable library feature |
235 | use self::inherited_stability::*; //~ ERROR use of unstable library feature | |
1a4d82fc JJ |
236 | |
237 | fn test_inheritance() { | |
c34b1796 | 238 | unstable(); //~ ERROR use of unstable library feature |
1a4d82fc JJ |
239 | stable(); |
240 | ||
c34b1796 | 241 | stable_mod::unstable(); //~ ERROR use of unstable library feature |
1a4d82fc JJ |
242 | stable_mod::stable(); |
243 | ||
85aaf69f | 244 | unstable_mod::deprecated(); //~ ERROR use of deprecated item |
c34b1796 | 245 | unstable_mod::unstable(); //~ ERROR use of unstable library feature |
1a4d82fc | 246 | |
c34b1796 | 247 | let _ = Unstable::UnstableVariant; //~ ERROR use of unstable library feature |
85aaf69f | 248 | let _ = Unstable::StableVariant; |
1a4d82fc JJ |
249 | |
250 | let x: usize = 0; | |
c34b1796 | 251 | x.unstable(); //~ ERROR use of unstable library feature |
1a4d82fc JJ |
252 | x.stable(); |
253 | } | |
254 | } | |
255 | ||
256 | mod this_crate { | |
85aaf69f SL |
257 | #[unstable(feature = "test_feature")] |
258 | #[deprecated(since = "1.0.0")] | |
1a4d82fc | 259 | pub fn deprecated() {} |
85aaf69f SL |
260 | #[unstable(feature = "test_feature")] |
261 | #[deprecated(since = "1.0.0", reason = "text")] | |
1a4d82fc JJ |
262 | pub fn deprecated_text() {} |
263 | ||
85aaf69f | 264 | #[unstable(feature = "test_feature")] |
1a4d82fc | 265 | pub fn unstable() {} |
85aaf69f | 266 | #[unstable(feature = "test_feature", reason = "text")] |
1a4d82fc JJ |
267 | pub fn unstable_text() {} |
268 | ||
85aaf69f | 269 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc | 270 | pub fn stable() {} |
85aaf69f | 271 | #[stable(feature = "rust1", since = "1.0.0", reason = "text")] |
1a4d82fc JJ |
272 | pub fn stable_text() {} |
273 | ||
85aaf69f | 274 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc JJ |
275 | pub struct MethodTester; |
276 | ||
277 | impl MethodTester { | |
85aaf69f SL |
278 | #[unstable(feature = "test_feature")] |
279 | #[deprecated(since = "1.0.0")] | |
1a4d82fc | 280 | pub fn method_deprecated(&self) {} |
85aaf69f SL |
281 | #[unstable(feature = "test_feature")] |
282 | #[deprecated(since = "1.0.0", reason = "text")] | |
1a4d82fc JJ |
283 | pub fn method_deprecated_text(&self) {} |
284 | ||
85aaf69f | 285 | #[unstable(feature = "test_feature")] |
1a4d82fc | 286 | pub fn method_unstable(&self) {} |
85aaf69f | 287 | #[unstable(feature = "test_feature", reason = "text")] |
1a4d82fc JJ |
288 | pub fn method_unstable_text(&self) {} |
289 | ||
85aaf69f | 290 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc | 291 | pub fn method_stable(&self) {} |
85aaf69f | 292 | #[stable(feature = "rust1", since = "1.0.0", reason = "text")] |
1a4d82fc | 293 | pub fn method_stable_text(&self) {} |
1a4d82fc JJ |
294 | } |
295 | ||
296 | pub trait Trait { | |
85aaf69f SL |
297 | #[unstable(feature = "test_feature")] |
298 | #[deprecated(since = "1.0.0")] | |
1a4d82fc | 299 | fn trait_deprecated(&self) {} |
85aaf69f SL |
300 | #[unstable(feature = "test_feature")] |
301 | #[deprecated(since = "1.0.0", reason = "text")] | |
1a4d82fc JJ |
302 | fn trait_deprecated_text(&self) {} |
303 | ||
85aaf69f | 304 | #[unstable(feature = "test_feature")] |
1a4d82fc | 305 | fn trait_unstable(&self) {} |
85aaf69f | 306 | #[unstable(feature = "test_feature", reason = "text")] |
1a4d82fc JJ |
307 | fn trait_unstable_text(&self) {} |
308 | ||
85aaf69f | 309 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc | 310 | fn trait_stable(&self) {} |
85aaf69f | 311 | #[stable(feature = "rust1", since = "1.0.0", reason = "text")] |
1a4d82fc | 312 | fn trait_stable_text(&self) {} |
1a4d82fc JJ |
313 | } |
314 | ||
315 | impl Trait for MethodTester {} | |
316 | ||
85aaf69f SL |
317 | #[unstable(feature = "test_feature")] |
318 | #[deprecated(since = "1.0.0")] | |
c34b1796 AL |
319 | pub struct DeprecatedStruct { |
320 | #[stable(feature = "test_feature", since = "1.0.0")] i: isize | |
321 | } | |
85aaf69f | 322 | #[unstable(feature = "test_feature")] |
c34b1796 AL |
323 | pub struct UnstableStruct { |
324 | #[stable(feature = "test_feature", since = "1.0.0")] i: isize | |
325 | } | |
85aaf69f | 326 | #[stable(feature = "rust1", since = "1.0.0")] |
c34b1796 AL |
327 | pub struct StableStruct { |
328 | #[stable(feature = "test_feature", since = "1.0.0")] i: isize | |
329 | } | |
1a4d82fc | 330 | |
85aaf69f SL |
331 | #[unstable(feature = "test_feature")] |
332 | #[deprecated(since = "1.0.0")] | |
1a4d82fc | 333 | pub struct DeprecatedUnitStruct; |
85aaf69f | 334 | #[unstable(feature = "test_feature")] |
1a4d82fc | 335 | pub struct UnstableUnitStruct; |
85aaf69f | 336 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc | 337 | pub struct StableUnitStruct; |
1a4d82fc JJ |
338 | |
339 | pub enum Enum { | |
85aaf69f SL |
340 | #[unstable(feature = "test_feature")] |
341 | #[deprecated(since = "1.0.0")] | |
1a4d82fc | 342 | DeprecatedVariant, |
85aaf69f | 343 | #[unstable(feature = "test_feature")] |
1a4d82fc JJ |
344 | UnstableVariant, |
345 | ||
85aaf69f | 346 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc | 347 | StableVariant, |
1a4d82fc JJ |
348 | } |
349 | ||
85aaf69f SL |
350 | #[unstable(feature = "test_feature")] |
351 | #[deprecated(since = "1.0.0")] | |
1a4d82fc | 352 | pub struct DeprecatedTupleStruct(isize); |
85aaf69f | 353 | #[unstable(feature = "test_feature")] |
1a4d82fc | 354 | pub struct UnstableTupleStruct(isize); |
85aaf69f | 355 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc | 356 | pub struct StableTupleStruct(isize); |
1a4d82fc JJ |
357 | |
358 | fn test() { | |
359 | // Only the deprecated cases of the following should generate | |
360 | // errors, because other stability attributes now have meaning | |
361 | // only *across* crates, not within a single crate. | |
362 | ||
c34b1796 | 363 | type Foo = MethodTester; |
1a4d82fc JJ |
364 | let foo = MethodTester; |
365 | ||
366 | deprecated(); //~ ERROR use of deprecated item | |
367 | foo.method_deprecated(); //~ ERROR use of deprecated item | |
c34b1796 AL |
368 | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item |
369 | <Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item | |
1a4d82fc | 370 | foo.trait_deprecated(); //~ ERROR use of deprecated item |
c34b1796 AL |
371 | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item |
372 | <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item | |
373 | <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item | |
1a4d82fc JJ |
374 | |
375 | deprecated_text(); //~ ERROR use of deprecated item: text | |
376 | foo.method_deprecated_text(); //~ ERROR use of deprecated item: text | |
c34b1796 AL |
377 | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text |
378 | <Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
1a4d82fc | 379 | foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text |
c34b1796 AL |
380 | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text |
381 | <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
382 | <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
1a4d82fc | 383 | |
1a4d82fc JJ |
384 | unstable(); |
385 | foo.method_unstable(); | |
c34b1796 AL |
386 | Foo::method_unstable(&foo); |
387 | <Foo>::method_unstable(&foo); | |
1a4d82fc | 388 | foo.trait_unstable(); |
c34b1796 AL |
389 | Trait::trait_unstable(&foo); |
390 | <Foo>::trait_unstable(&foo); | |
391 | <Foo as Trait>::trait_unstable(&foo); | |
1a4d82fc JJ |
392 | |
393 | unstable_text(); | |
394 | foo.method_unstable_text(); | |
c34b1796 AL |
395 | Foo::method_unstable_text(&foo); |
396 | <Foo>::method_unstable_text(&foo); | |
1a4d82fc | 397 | foo.trait_unstable_text(); |
c34b1796 AL |
398 | Trait::trait_unstable_text(&foo); |
399 | <Foo>::trait_unstable_text(&foo); | |
400 | <Foo as Trait>::trait_unstable_text(&foo); | |
1a4d82fc | 401 | |
1a4d82fc JJ |
402 | stable(); |
403 | foo.method_stable(); | |
c34b1796 AL |
404 | Foo::method_stable(&foo); |
405 | <Foo>::method_stable(&foo); | |
1a4d82fc | 406 | foo.trait_stable(); |
c34b1796 AL |
407 | Trait::trait_stable(&foo); |
408 | <Foo>::trait_stable(&foo); | |
409 | <Foo as Trait>::trait_stable(&foo); | |
1a4d82fc JJ |
410 | |
411 | stable_text(); | |
412 | foo.method_stable_text(); | |
c34b1796 AL |
413 | Foo::method_stable_text(&foo); |
414 | <Foo>::method_stable_text(&foo); | |
1a4d82fc | 415 | foo.trait_stable_text(); |
c34b1796 AL |
416 | Trait::trait_stable_text(&foo); |
417 | <Foo>::trait_stable_text(&foo); | |
418 | <Foo as Trait>::trait_stable_text(&foo); | |
1a4d82fc | 419 | |
1a4d82fc | 420 | let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item |
1a4d82fc | 421 | let _ = UnstableStruct { i: 0 }; |
1a4d82fc | 422 | let _ = StableStruct { i: 0 }; |
1a4d82fc JJ |
423 | |
424 | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item | |
1a4d82fc | 425 | let _ = UnstableUnitStruct; |
1a4d82fc | 426 | let _ = StableUnitStruct; |
1a4d82fc JJ |
427 | |
428 | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item | |
1a4d82fc | 429 | let _ = Enum::UnstableVariant; |
1a4d82fc | 430 | let _ = Enum::StableVariant; |
1a4d82fc JJ |
431 | |
432 | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item | |
1a4d82fc | 433 | let _ = UnstableTupleStruct (1); |
1a4d82fc | 434 | let _ = StableTupleStruct (1); |
1a4d82fc JJ |
435 | } |
436 | ||
c34b1796 | 437 | fn test_method_param<Foo: Trait>(foo: Foo) { |
1a4d82fc | 438 | foo.trait_deprecated(); //~ ERROR use of deprecated item |
c34b1796 AL |
439 | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item |
440 | <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item | |
441 | <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item | |
1a4d82fc | 442 | foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text |
c34b1796 AL |
443 | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text |
444 | <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
445 | <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text | |
1a4d82fc | 446 | foo.trait_unstable(); |
c34b1796 AL |
447 | Trait::trait_unstable(&foo); |
448 | <Foo>::trait_unstable(&foo); | |
449 | <Foo as Trait>::trait_unstable(&foo); | |
1a4d82fc | 450 | foo.trait_unstable_text(); |
c34b1796 AL |
451 | Trait::trait_unstable_text(&foo); |
452 | <Foo>::trait_unstable_text(&foo); | |
453 | <Foo as Trait>::trait_unstable_text(&foo); | |
1a4d82fc | 454 | foo.trait_stable(); |
c34b1796 AL |
455 | Trait::trait_stable(&foo); |
456 | <Foo>::trait_stable(&foo); | |
457 | <Foo as Trait>::trait_stable(&foo); | |
1a4d82fc JJ |
458 | } |
459 | ||
460 | fn test_method_object(foo: &Trait) { | |
461 | foo.trait_deprecated(); //~ ERROR use of deprecated item | |
462 | foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text | |
1a4d82fc JJ |
463 | foo.trait_unstable(); |
464 | foo.trait_unstable_text(); | |
1a4d82fc JJ |
465 | foo.trait_stable(); |
466 | } | |
467 | ||
85aaf69f SL |
468 | #[unstable(feature = "test_feature")] |
469 | #[deprecated(since = "1.0.0")] | |
1a4d82fc JJ |
470 | fn test_fn_body() { |
471 | fn fn_in_body() {} | |
472 | fn_in_body(); | |
473 | } | |
474 | ||
475 | impl MethodTester { | |
85aaf69f SL |
476 | #[unstable(feature = "test_feature")] |
477 | #[deprecated(since = "1.0.0")] | |
1a4d82fc JJ |
478 | fn test_method_body(&self) { |
479 | fn fn_in_body() {} | |
480 | fn_in_body(); | |
481 | } | |
482 | } | |
483 | ||
85aaf69f SL |
484 | #[unstable(feature = "test_feature")] |
485 | #[deprecated(since = "1.0.0")] | |
486 | pub trait DeprecatedTrait { | |
487 | fn dummy(&self) { } | |
488 | } | |
1a4d82fc JJ |
489 | |
490 | struct S; | |
491 | ||
492 | impl DeprecatedTrait for S { } //~ ERROR use of deprecated item | |
493 | ||
494 | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item | |
495 | } | |
496 | ||
497 | fn main() {} |