mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-27 18:56:24 +00:00
11 lines
223 B
Rust
11 lines
223 B
Rust
fn main() {
|
|
let mut x = "foo";
|
|
let y = &mut x;
|
|
let z = &mut x; //~ ERROR cannot borrow
|
|
z.use_mut();
|
|
y.use_mut();
|
|
}
|
|
|
|
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
|
|
impl<T> Fake for T { }
|