mozilla/rust — Issue #1822: Better error message for "argument 1 may alias with argument 0, which is not immutably rooted"
Author: hildjj
Created: 2012-02-12 17:13:54+00:00
State: open

Given this program:

```
use std;

fn main() {
let a = {mutable foo: [mutable 1u]};
vec::iteri(a.foo) {|i, v|
#error("%u = %u", i, v);
}
}```

The error produced is: "m.rs:5:19: 7:2 error: argument 1 may alias with argument 0, which is not immutably rooted", which is more than a little jargon-y. If this is really an error, then it should be easier to understand what the problem is. Note that this program compiles cleanly:

```
use std;

fn main() {
let a = {mutable foo: [mutable 1u]};
let f = a.foo; // add a temp
vec::iteri(f) {|i, v|
#error("%u = %u", i, v);
}
}```