rust/tests/ui/issues/issue-42106.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
259 B
Rust
Raw Normal View History

fn do_something<T>(collection: &mut Vec<T>) {
let _a = &collection;
2017-11-20 12:13:27 +00:00
collection.swap(1, 2); //~ ERROR also borrowed as immutable
_a.use_ref();
}
fn main() { }
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
impl<T> Fake for T { }