mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 03:25:55 +00:00
12 lines
288 B
Rust
12 lines
288 B
Rust
#![feature(rustc_attrs)]
|
|
fn main() { #![rustc_error] // rust-lang/rust#49855
|
|
let mut x = "foo";
|
|
let y = &mut x;
|
|
let z = &mut x; //~ ERROR cannot borrow
|
|
z.use_mut();
|
|
y.use_mut();
|
|
}
|
|
|
|
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
|
|
impl<T> Fake for T { }
|