]> git.lizzy.rs Git - rust.git/blob - tests/ui/feature-gates/issue-43106-gating-of-stable.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / feature-gates / issue-43106-gating-of-stable.rs
1 // Testing gating of `#[stable]` in "weird" places.
2 //
3 // This file sits on its own because these signal errors, making
4 // this test incompatible with the "warnings only" nature of
5 // issue-43106-gating-of-builtin-attrs.rs
6
7 #![stable()]
8 //~^ ERROR stability attributes may not be used outside of the standard library
9
10 #[stable()]
11 //~^ ERROR stability attributes may not be used outside of the standard library
12 mod stable {
13     mod inner {
14         #![stable()]
15         //~^ ERROR stability attributes may not be used outside of the standard library
16     }
17
18     #[stable()]
19     //~^ ERROR stability attributes may not be used outside of the standard library
20     fn f() {}
21
22     #[stable()]
23     //~^ ERROR stability attributes may not be used outside of the standard library
24     struct S;
25
26     #[stable()]
27     //~^ ERROR stability attributes may not be used outside of the standard library
28     type T = S;
29
30     #[stable()]
31     //~^ ERROR stability attributes may not be used outside of the standard library
32     impl S {}
33 }
34
35 fn main() {}