rust/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs

23 lines
525 B
Rust
Raw Normal View History

// revisions: ast mir
//[mir]compile-flags: -Z borrowck=mir
2015-01-03 09:45:00 -06:00
fn with<F>(f: F) where F: FnOnce(&String) {}
fn arg_item(&_x: &String) {}
//[ast]~^ ERROR cannot move out of borrowed content [E0507]
//[mir]~^^ ERROR [E0507]
fn arg_closure() {
with(|&_x| ())
//[ast]~^ ERROR cannot move out of borrowed content [E0507]
//[mir]~^^ ERROR [E0507]
}
fn let_pat() {
2014-05-25 05:10:11 -05:00
let &_x = &"hi".to_string();
//[ast]~^ ERROR cannot move out of borrowed content [E0507]
//[mir]~^^ ERROR [E0507]
}
pub fn main() {}