rust/tests/ui/codemap_tests/issue-11715.rs

11 lines
223 B
Rust
Raw Permalink Normal View History

2025-03-29 21:39:55 +00:00
fn main() {
let mut x = "foo";
let y = &mut x;
2017-11-20 12:13:27 +00:00
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 { }