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-11 02:58:23 +00:00
fn box_imm() {
let v = Box::new(3);
let w = &v;
2013-03-15 19:24:24 +00:00
take(v); //~ ERROR cannot move out of `v` because it is borrowed
w.use_ref();
2012-05-11 02:58:23 +00:00
}
fn main() {
}
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
impl<T> Fake for T { }