2018-04-11 00:20:05 +02:00
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
fn main() { #![rustc_error] // rust-lang/rust#49855
|
2016-07-13 17:53:42 -04:00
|
|
|
let mut x = "foo";
|
|
|
|
let y = &mut x;
|
2017-11-20 13:13:27 +01:00
|
|
|
let z = &mut x; //~ ERROR cannot borrow
|
2018-05-25 12:36:58 +02:00
|
|
|
z.use_mut();
|
|
|
|
y.use_mut();
|
2016-07-13 17:53:42 -04:00
|
|
|
}
|
2018-05-25 12:36:58 +02:00
|
|
|
|
|
|
|
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
|
|
|
|
impl<T> Fake for T { }
|