Also test projections

This commit is contained in:
Oliver Scherer 2018-12-17 14:36:10 +01:00
parent f8e508cde4
commit b9d74fc3ce
3 changed files with 18 additions and 1 deletions

View file

@ -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() {}

View 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() {}

View 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`.