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