Also test projections
This commit is contained in:
parent
f8e508cde4
commit
b9d74fc3ce
3 changed files with 18 additions and 1 deletions
|
|
@ -3,6 +3,6 @@
|
|||
static mut STDERR_BUFFER_SPACE: u8 = 0;
|
||||
|
||||
pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; };
|
||||
//~^ references in statics may only refer to immutable values
|
||||
//~^ ERROR references in statics may only refer to immutable values
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
8
src/test/ui/consts/static_mut_containing_mut_ref3.rs
Normal file
8
src/test/ui/consts/static_mut_containing_mut_ref3.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#![feature(const_let)]
|
||||
|
||||
static mut FOO: (u8, u8) = (42, 43);
|
||||
|
||||
static mut BAR: () = unsafe { FOO.0 = 99; };
|
||||
//~^ ERROR could not evaluate static initializer
|
||||
|
||||
fn main() {}
|
||||
9
src/test/ui/consts/static_mut_containing_mut_ref3.stderr
Normal file
9
src/test/ui/consts/static_mut_containing_mut_ref3.stderr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
error[E0080]: could not evaluate static initializer
|
||||
--> $DIR/static_mut_containing_mut_ref3.rs:5:31
|
||||
|
|
||||
LL | static mut BAR: () = unsafe { FOO.0 = 99; };
|
||||
| ^^^^^^^^^^ tried to modify a static's initial value from another static's initializer
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue