]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hygiene/fields-numeric-borrowck.rs
Merge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyup
[rust.git] / src / test / ui / hygiene / fields-numeric-borrowck.rs
1 struct S(u8);
2
3 fn main() {
4     let mut s = S(0);
5     let borrow1 = &mut s.0;
6     let S { 0: ref mut borrow2 } = s;
7     //~^ ERROR cannot borrow `s.0` as mutable more than once at a time
8     borrow2.use_mut();
9     borrow1.use_mut();
10 }
11
12 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { }  }
13 impl<T> Fake for T { }