From 59c6c4942ab0f8ebfdfa0be7e2cc9f9a811d7585 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 23 Nov 2018 15:17:26 +0100 Subject: [PATCH] Also test the `const_let` feature gate in statics --- .../feature-gates/feature-gate-const_let.rs | 9 ++++ .../feature-gate-const_let.stderr | 46 ++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/test/ui/feature-gates/feature-gate-const_let.rs b/src/test/ui/feature-gates/feature-gate-const_let.rs index aad251a205e9..9bf957a5f1e0 100644 --- a/src/test/ui/feature-gates/feature-gate-const_let.rs +++ b/src/test/ui/feature-gates/feature-gate-const_let.rs @@ -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() {} diff --git a/src/test/ui/feature-gates/feature-gate-const_let.stderr b/src/test/ui/feature-gates/feature-gate-const_let.stderr index 4fab6ec540eb..acb5165918e2 100644 --- a/src/test/ui/feature-gates/feature-gate-const_let.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_let.stderr @@ -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`.