File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
src/test/ui/consts/const-eval Expand file tree Collapse file tree 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 {}
2323
2424static FOO : Foo = Foo ( UnsafeCell :: new ( 42 ) ) ;
2525
26+ fn foo ( ) { }
27+
2628static BAR : ( ) = unsafe {
2729 * FOO . 0 . get ( ) = 5 ;
2830 //~^ ERROR statements in statics are unstable (see issue #48821)
2931 // This error is caused by a separate bug that the feature gate error is reported
3032 // 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
3136} ;
3237
3338fn main ( ) {
Original file line number Diff line number Diff line change 11error[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
33 |
44LL | *FOO.0.get() = 5;
55 | ^^^^^^^^^^^^^^^^
66 |
77 = help: add #![feature(const_let)] to the crate attributes to enable
88
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
1016
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