Skip to content

Commit

Permalink
adjust ui/../mod-static-with-const-fn.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Nov 10, 2018
1 parent ea73edb commit ac1c6b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/test/ui/consts/const-eval/mod-static-with-const-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ unsafe impl Sync for Foo {}

static FOO: Foo = Foo(UnsafeCell::new(42));

fn foo() {}

static BAR: () = unsafe {
*FOO.0.get() = 5;
//~^ ERROR statements in statics are unstable (see issue #48821)
// This error is caused by a separate bug that the feature gate error is reported
// even though the feature gate "const_let" is active.

foo();
//~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants
};

fn main() {
Expand Down
13 changes: 10 additions & 3 deletions src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
error[E0658]: statements in statics are unstable (see issue #48821)
--> $DIR/mod-static-with-const-fn.rs:27:5
--> $DIR/mod-static-with-const-fn.rs:29:5
|
LL | *FOO.0.get() = 5;
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(const_let)] to the crate attributes to enable

error: aborting due to previous error
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
--> $DIR/mod-static-with-const-fn.rs:34:5
|
LL | foo();
| ^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
Some errors occurred: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.

0 comments on commit ac1c6b0

Please sign in to comment.