1 #![feature(rustc_attrs)]
3 fn main() { #![rustc_error] // rust-lang/rust#49855
4 // Original borrow ends at end of function
7 //~^ mutable borrow occurs here
8 let z = &x; //~ ERROR cannot borrow
9 //~^ immutable borrow occurs here
17 // Original borrow ends at end of match arm
20 //~^ immutable borrow occurs here
21 let z = &mut x; //~ ERROR cannot borrow
22 //~^ mutable borrow occurs here
31 // Original borrow ends at end of closure
35 //~^ first mutable borrow occurs here
36 let z = &mut x; //~ ERROR cannot borrow
37 //~^ second mutable borrow occurs here
43 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
44 impl<T> Fake for T { }