Skip to content

Commit 7e2e489

Browse files
committed
Also test projections
1 parent b31a1f7 commit 7e2e489

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Diff for: src/test/ui/consts/static_mut_containing_mut_ref2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
static mut STDERR_BUFFER_SPACE: u8 = 0;
44

55
pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; };
6-
//~^ references in statics may only refer to immutable values
6+
//~^ ERROR references in statics may only refer to immutable values
77

88
fn main() {}

Diff for: src/test/ui/consts/static_mut_containing_mut_ref3.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![feature(const_let)]
2+
3+
static mut FOO: (u8, u8) = (42, 43);
4+
5+
static mut BAR: () = unsafe { FOO.0 = 99; };
6+
//~^ ERROR could not evaluate static initializer
7+
8+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0080]: could not evaluate static initializer
2+
--> $DIR/static_mut_containing_mut_ref3.rs:5:31
3+
|
4+
LL | static mut BAR: () = unsafe { FOO.0 = 99; };
5+
| ^^^^^^^^^^ tried to modify a static's initial value from another static's initializer
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)