]> git.lizzy.rs Git - rust.git/commitdiff
adjust ui/../mod-static-with-const-fn.rs
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 10 Nov 2018 01:36:19 +0000 (02:36 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sat, 10 Nov 2018 01:36:19 +0000 (02:36 +0100)
src/test/ui/consts/const-eval/mod-static-with-const-fn.rs
src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr

index b6e6021aeda6dc8e3029ed8c7913c603532840af..4136a7b6a724f2416970fd87009541dfc377fe78 100644 (file)
@@ -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() {
index 23bd30b641225fbed06580dd1374929d6276a320..c2bba27e4d1e29992595d93cd3daef068e290857 100644 (file)
@@ -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`.