rust/src/test/run-fail/borrowck-wg-imm-then-mut.rs
2013-10-23 18:06:12 -04:00

22 lines
276 B
Rust

#[feature(managed_boxes)];
// error-pattern:borrowed
// Test that if you imm borrow then mut borrow it fails.
fn add1(a:@mut int)
{
add2(a); // already frozen
}
fn add2(_:&mut int)
{
}
pub fn main()
{
let a = @mut 3;
let _b = &*a; // freezes a
add1(a);
}