1
Fork 0
rust/src/test/ui/error-codes/E0017.rs

14 lines
536 B
Rust
Raw Normal View History

2016-05-12 15:17:02 +02:00
static X: i32 = 1;
const C: i32 = 2;
static mut M: i32 = 3;
2016-05-12 15:17:02 +02:00
2020-06-18 14:52:37 -05:00
const CR: &'static mut i32 = &mut C; //~ ERROR E0764
//~| WARN taking a mutable
2020-06-18 14:52:37 -05:00
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0764
//~| ERROR cannot borrow
2020-09-29 17:31:04 -07:00
2020-06-18 14:52:37 -05:00
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764
//~| WARN taking a mutable
2020-06-18 14:52:37 -05:00
static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0764
2016-05-12 15:17:02 +02:00
fn main() {}