2016-05-12 13:17:02 +00:00
|
|
|
static X: i32 = 1;
|
|
|
|
const C: i32 = 2;
|
2019-11-27 01:08:46 +00:00
|
|
|
static mut M: i32 = 3;
|
2016-05-12 13:17:02 +00:00
|
|
|
|
2021-01-03 18:46:20 +00:00
|
|
|
const CR: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
|
2020-08-10 11:16:30 +00:00
|
|
|
//~| WARN taking a mutable
|
2021-01-03 18:46:20 +00:00
|
|
|
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0658
|
2017-02-18 11:52:16 +00:00
|
|
|
//~| ERROR cannot borrow
|
2021-01-03 18:46:20 +00:00
|
|
|
//~| ERROR mutable references are not allowed
|
2020-09-30 00:31:04 +00:00
|
|
|
|
2021-01-03 18:46:20 +00:00
|
|
|
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
|
2020-08-10 11:16:30 +00:00
|
|
|
//~| WARN taking a mutable
|
2021-01-03 18:46:20 +00:00
|
|
|
static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR mutable references are not
|
2016-05-12 13:17:02 +00:00
|
|
|
fn main() {}
|