rust/src/test/ui/immut-function-arguments.rs
2018-12-25 21:08:33 -07:00

15 lines
302 B
Rust

// revisions: ast mir
//[mir]compile-flags: -Z borrowck=mir
fn f(y: Box<isize>) {
*y = 5; //[ast]~ ERROR cannot assign
//[mir]~^ ERROR cannot assign
}
fn g() {
let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign
//[mir]~^ ERROR cannot assign
}
fn main() {}