2011-09-12 14:24:12 +02:00
|
|
|
// error-pattern:mutable reference to a variable that roots another reference
|
2011-06-10 16:38:13 +02:00
|
|
|
|
2011-09-12 12:39:38 +02:00
|
|
|
fn f(a: {mutable x: int}, &b: {mutable x: int}) -> int {
|
2011-09-12 11:27:30 +02:00
|
|
|
b.x += 1;
|
|
|
|
ret a.x + b.x;
|
2011-09-12 10:12:36 +02:00
|
|
|
}
|
2011-06-10 16:38:13 +02:00
|
|
|
|
2011-12-22 14:42:52 -08:00
|
|
|
fn main() { let i = {mutable x: 4}; log_full(core::debug, f(i, i)); }
|