]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #39361 - cengizIO:master, r=arielb1
authorCorey Farwell <coreyf@rwell.org>
Wed, 8 Feb 2017 03:54:20 +0000 (22:54 -0500)
committerGitHub <noreply@github.com>
Wed, 8 Feb 2017 03:54:20 +0000 (22:54 -0500)
Improve error message for uninferrable types #38812

Hello,

I tried to improve the error message for uninferrable types. The error code is `E0282`.

```rust

error[E0282]: type annotations needed
 --> /home/cengizIO/issue38812.rs:2:11
  |
2 |   let x = vec![];
  |       -   ^^^^^^ cannot infer type for `T`
  |       |
  |       consider giving `x` a type
  |
  = note: this error originates in a macro outside of the current crate
```

and

```rust

error[E0282]: type annotations needed
 --> /home/cengizIO/issue38812.rs:2:15
  |
2 |   let (x,) = (vec![],);
  |       ----    ^^^^^^ cannot infer type for `T`
  |       |
  |       consider giving a type to pattern
  |
  = note: this error originates in a macro outside of the current crate
```

Rust compiler now tries to find uninferred `local`s with type `_` and adds them into the error message.

I'm probably wrong on wording that I used. Please feel free to suggest better alternatives.

Thanks @nikomatsakis for mentoring 🍺

Any comments/feedback is more than welcome!

Thank you


Trivial merge