rust/src/test/run-fail/borrowck-wg-fail-2.rs

16 lines
237 B
Rust
Raw Normal View History

// error-pattern:borrowed
// Test that write guards trigger when there is a write to a field
// of a frozen structure.
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;
}