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