2012-03-26 20:35:18 -05:00
|
|
|
// error-pattern:mut reference to a variable that roots another reference
|
2011-06-10 09:38:13 -05:00
|
|
|
|
2012-03-26 20:35:18 -05:00
|
|
|
fn f(a: {mut x: int}, &b: {mut x: int}) -> int {
|
2011-09-12 04:27:30 -05:00
|
|
|
b.x += 1;
|
|
|
|
ret a.x + b.x;
|
2011-09-12 03:12:36 -05:00
|
|
|
}
|
2011-06-10 09:38:13 -05:00
|
|
|
|
2012-03-26 20:35:18 -05:00
|
|
|
fn main() { let i = {mut x: 4}; log(debug, f(i, i)); }
|