rust/tests/ui/borrowck/borrowck-loan-blocks-move.rs

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

20 lines
280 B
Rust
Raw Normal View History

fn take(_v: Box<isize>) {
}
2012-05-10 21:58:23 -05:00
fn box_imm() {
let v = Box::new(3);
let w = &v;
2013-03-15 14:24:24 -05:00
take(v); //~ ERROR cannot move out of `v` because it is borrowed
w.use_ref();
2012-05-10 21:58:23 -05:00
}
fn main() {
}
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
impl<T> Fake for T { }