rust/src/librustc_errors
bors 89500e9341 Auto merge of #36338 - estebank:primitive-shadow, r=jseyfried
Be more specific when type parameter shadows primitive type

When a type parameter shadows a primitive type, the error message
was non obvious. For example, given the file `file.rs`:

```rust
trait Parser<T> {
    fn parse(text: &str) -> Option<T>;
}

impl<bool> Parser<bool> for bool {
    fn parse(text: &str) -> Option<bool> {
        Some(true)
    }
}

fn main() {
    println!("{}", bool::parse("ok").unwrap_or(false));
}
```

The output was:

```bash
% rustc file.rs
error[E0308]: mismatched types
 --> file.rs:7:14
  |
7 |         Some(true)
  |              ^^^^ expected type parameter, found bool a
  |
  = note: expected type `bool`
  = note:    found type `bool`

error: aborting due to previous error
```

We now show extra information about the type:

```bash
% rustc file.rs
error[E0308]: mismatched types
 --> file.rs:7:14
  |
7 |         Some(true)
  |              ^^^^ expected type parameter, found bool a
  |
  = note: expected type `bool` (type parameter)
  = note:    found type `bool` (bool)

error: aborting due to previous error
```

Fixes #35030
2016-09-16 00:39:27 -07:00
..
Cargo.toml
emitter.rs Use question_mark feature in librustc_errors. 2016-09-11 16:00:50 -07:00
lib.rs Specify when type parameter shadows primitive type 2016-09-15 20:06:29 -07:00
lock.rs prevent error message interleaving on win/unix 2016-08-25 13:28:35 -07:00
registry.rs
snippet.rs Turn on new errors, json mode. Remove duplicate unicode test 2016-08-07 07:46:49 -07:00
styled_buffer.rs Add fix for tabs. Move error unit tests->ui tests 2016-07-14 07:57:46 -04:00