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