rust/src/test/ui/consts/issue-17718-const-bad-values.rs

11 lines
344 B
Rust
Raw Normal View History

const C1: &'static mut [usize] = &mut [];
//~^ ERROR: mutable references are not allowed in constants
static mut S: usize = 3;
const C2: &'static mut usize = unsafe { &mut S };
//~^ ERROR: constants cannot refer to statics
2020-01-08 11:02:10 -06:00
//~| ERROR: constants cannot refer to statics
//~| ERROR: mutable references are not allowed in constants
fn main() {}