2013-05-05 20:05:37 -05:00
|
|
|
// error-pattern:borrowed
|
|
|
|
|
|
|
|
// Test that if you mut borrow then imm borrow it fails.
|
|
|
|
|
|
|
|
fn add1(a:@mut int)
|
|
|
|
{
|
|
|
|
add2(a); // already frozen
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add2(_:&int)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main()
|
|
|
|
{
|
|
|
|
let a = @mut 3;
|
2013-08-17 10:37:42 -05:00
|
|
|
let _b = &mut *a; // freezes a
|
2013-05-05 20:05:37 -05:00
|
|
|
add1(a);
|
|
|
|
}
|