Skip to content

Commit ac1c6b0

Browse files
committed
adjust ui/../mod-static-with-const-fn.rs
1 parent ea73edb commit ac1c6b0

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/test/ui/consts/const-eval/mod-static-with-const-fn.rs

+5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,16 @@ unsafe impl Sync for Foo {}
2323

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

26+
fn foo() {}
27+
2628
static 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

3338
fn main() {
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
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
33
|
44
LL | *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`.

0 commit comments

Comments
 (0)