mozilla/rust — Issue #1871: Multiple error messages for the same span
Author: catamorphism
Created: 2012-02-21 02:12:18+00:00
State: open
Labels: A-frontend, I-papercut

```
fn main() {
let f = 42;

let _g = if f < 5 {
f.honk();
}
else {
12
};
}
```

If I compile this code, I get two error messages for (basically) the same span:

```
/Users/TimChevalier/silly.rs:5:6: 5:12 error: attempted access of field honk on type int, but no method implementation was found
/Users/TimChevalier/silly.rs:5 f.honk();
^~~~~~
/Users/TimChevalier/silly.rs:5:6: 5:14 error: mismatched types: expected function or native function but found ()
/Users/TimChevalier/silly.rs:5 f.honk();
^~~~~~~~
```

This kind of thing gets annoying fast. Would it be reasonable to only print an error message for the smallest sub-span when there are multiple error messages such that one span encloses the other? (In this case, the spans aren't exactly the same, but we should see the first error and realize "oh, we don't need to print out the second error, since its span is a superspan of the other")