Also test the const_let feature gate in statics

This commit is contained in:
Oliver Scherer 2018-11-23 15:17:26 +01:00
parent ef38afc83d
commit 59c6c4942a
2 changed files with 54 additions and 1 deletions

View file

@ -19,4 +19,13 @@ const FOO: usize = {
42
};
static BAR: usize = {
//~^ ERROR statements in statics are unstable
//~| ERROR: let bindings in statics are unstable
let x = 42;
//~^ ERROR statements in statics are unstable
//~| ERROR: let bindings in statics are unstable
42
};
fn main() {}

View file

@ -42,6 +42,50 @@ LL | | };
|
= help: add #![feature(const_let)] to the crate attributes to enable
error: aborting due to 4 previous errors
error[E0658]: let bindings in statics are unstable (see issue #48821)
--> $DIR/feature-gate-const_let.rs:25:13
|
LL | let x = 42;
| ^^
|
= help: add #![feature(const_let)] to the crate attributes to enable
error[E0658]: statements in statics are unstable (see issue #48821)
--> $DIR/feature-gate-const_let.rs:25:13
|
LL | let x = 42;
| ^^
|
= help: add #![feature(const_let)] to the crate attributes to enable
error[E0658]: let bindings in statics are unstable (see issue #48821)
--> $DIR/feature-gate-const_let.rs:22:1
|
LL | / static BAR: usize = {
LL | | //~^ ERROR statements in statics are unstable
LL | | //~| ERROR: let bindings in statics are unstable
LL | | let x = 42;
... |
LL | | 42
LL | | };
| |__^
|
= help: add #![feature(const_let)] to the crate attributes to enable
error[E0658]: statements in statics are unstable (see issue #48821)
--> $DIR/feature-gate-const_let.rs:22:1
|
LL | / static BAR: usize = {
LL | | //~^ ERROR statements in statics are unstable
LL | | //~| ERROR: let bindings in statics are unstable
LL | | let x = 42;
... |
LL | | 42
LL | | };
| |__^
|
= help: add #![feature(const_let)] to the crate attributes to enable
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0658`.