rust/src/test/compile-fail/unsafe-for.rs

7 lines
170 B
Rust
Raw Normal View History

// error-pattern:invalidate reference x
2011-06-08 22:48:19 +02:00
fn main() {
2011-09-13 12:31:16 +02:00
let v: [mutable {mutable x: int}] = [mutable {mutable x: 1}];
for x in v { v[0] = {mutable x: 2}; log x; }
}