rust/tests/ui/error-codes/E0017.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
520 B
Rust
Raw Normal View History

//@ normalize-stderr-test: "\(size: ., align: .\)" -> ""
//@ normalize-stderr-test: " +│ ╾─+╼" -> ""
2016-05-12 08:17:02 -05:00
static X: i32 = 1;
const C: i32 = 2;
static mut M: i32 = 3;
2016-05-12 08:17:02 -05:00
const CR: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
//~| WARN taking a mutable
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR cannot borrow immutable static item `X` as mutable
2020-09-29 19:31:04 -05:00
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
//~| WARN taking a mutable
2016-05-12 08:17:02 -05:00
fn main() {}