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