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