]> git.lizzy.rs Git - rust.git/blob - tests/ui/mut/mut-cant-alias.rs
Rollup merge of #106805 - madsravn:master, r=compiler-errors
[rust.git] / tests / ui / mut / mut-cant-alias.rs
1 use std::cell::RefCell;
2
3
4
5 fn main() {
6     let m = RefCell::new(0);
7     let mut b = m.borrow_mut();
8     let b1 = &mut *b;
9     let b2 = &mut *b; //~ ERROR cannot borrow
10     b1.use_mut();
11 }
12
13 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { }  }
14 impl<T> Fake for T { }