File tree 2 files changed +15
-3
lines changed
src/test/ui/consts/const-eval
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,16 @@ unsafe impl Sync for Foo {}
23
23
24
24
static FOO : Foo = Foo ( UnsafeCell :: new ( 42 ) ) ;
25
25
26
+ fn foo ( ) { }
27
+
26
28
static BAR : ( ) = unsafe {
27
29
* FOO . 0 . get ( ) = 5 ;
28
30
//~^ ERROR statements in statics are unstable (see issue #48821)
29
31
// This error is caused by a separate bug that the feature gate error is reported
30
32
// even though the feature gate "const_let" is active.
33
+
34
+ foo ( ) ;
35
+ //~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants
31
36
} ;
32
37
33
38
fn main ( ) {
Original file line number Diff line number Diff line change 1
1
error[E0658]: statements in statics are unstable (see issue #48821)
2
- --> $DIR/mod-static-with-const-fn.rs:27 :5
2
+ --> $DIR/mod-static-with-const-fn.rs:29 :5
3
3
|
4
4
LL | *FOO.0.get() = 5;
5
5
| ^^^^^^^^^^^^^^^^
6
6
|
7
7
= help: add #![feature(const_let)] to the crate attributes to enable
8
8
9
- error: aborting due to previous error
9
+ error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
10
+ --> $DIR/mod-static-with-const-fn.rs:34:5
11
+ |
12
+ LL | foo();
13
+ | ^^^^^
14
+
15
+ error: aborting due to 2 previous errors
10
16
11
- For more information about this error, try `rustc --explain E0658`.
17
+ Some errors occurred: E0015, E0658.
18
+ For more information about an error, try `rustc --explain E0015`.
You can’t perform that action at this time.
0 commit comments