Skip to content

Commit 59c6c49

Browse files
committed
Also test the const_let feature gate in statics
1 parent ef38afc commit 59c6c49

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

src/test/ui/feature-gates/feature-gate-const_let.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,13 @@ const FOO: usize = {
1919
42
2020
};
2121

22+
static BAR: usize = {
23+
//~^ ERROR statements in statics are unstable
24+
//~| ERROR: let bindings in statics are unstable
25+
let x = 42;
26+
//~^ ERROR statements in statics are unstable
27+
//~| ERROR: let bindings in statics are unstable
28+
42
29+
};
30+
2231
fn main() {}

src/test/ui/feature-gates/feature-gate-const_let.stderr

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,50 @@ LL | | };
4242
|
4343
= help: add #![feature(const_let)] to the crate attributes to enable
4444

45-
error: aborting due to 4 previous errors
45+
error[E0658]: let bindings in statics are unstable (see issue #48821)
46+
--> $DIR/feature-gate-const_let.rs:25:13
47+
|
48+
LL | let x = 42;
49+
| ^^
50+
|
51+
= help: add #![feature(const_let)] to the crate attributes to enable
52+
53+
error[E0658]: statements in statics are unstable (see issue #48821)
54+
--> $DIR/feature-gate-const_let.rs:25:13
55+
|
56+
LL | let x = 42;
57+
| ^^
58+
|
59+
= help: add #![feature(const_let)] to the crate attributes to enable
60+
61+
error[E0658]: let bindings in statics are unstable (see issue #48821)
62+
--> $DIR/feature-gate-const_let.rs:22:1
63+
|
64+
LL | / static BAR: usize = {
65+
LL | | //~^ ERROR statements in statics are unstable
66+
LL | | //~| ERROR: let bindings in statics are unstable
67+
LL | | let x = 42;
68+
... |
69+
LL | | 42
70+
LL | | };
71+
| |__^
72+
|
73+
= help: add #![feature(const_let)] to the crate attributes to enable
74+
75+
error[E0658]: statements in statics are unstable (see issue #48821)
76+
--> $DIR/feature-gate-const_let.rs:22:1
77+
|
78+
LL | / static BAR: usize = {
79+
LL | | //~^ ERROR statements in statics are unstable
80+
LL | | //~| ERROR: let bindings in statics are unstable
81+
LL | | let x = 42;
82+
... |
83+
LL | | 42
84+
LL | | };
85+
| |__^
86+
|
87+
= help: add #![feature(const_let)] to the crate attributes to enable
88+
89+
error: aborting due to 8 previous errors
4690

4791
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)