2013-01-11 21:01:42 -08:00
|
|
|
// error-pattern:borrowed
|
|
|
|
|
2013-05-03 16:26:43 -04:00
|
|
|
// Test that write guards trigger when there is a write to a field
|
|
|
|
// of a frozen structure.
|
|
|
|
|
2013-01-11 21:01:42 -08:00
|
|
|
struct S {
|
|
|
|
x: int
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = @mut S { x: 3 };
|
2013-08-17 08:37:42 -07:00
|
|
|
let _y: &S = x;
|
2013-04-30 16:35:01 -04:00
|
|
|
let z = x;
|
|
|
|
z.x = 5;
|
2013-01-11 21:01:42 -08:00
|
|
|
}
|