2025-03-30 00:39:55 +03:00
|
|
|
fn main() {
|
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 { }
|