Commit Graph

8 Commits

Author SHA1 Message Date
Esteban Küber
e420f4410b Account for cases where we can find the type arg name, but the local name is _ 2019-06-01 15:33:31 -07:00
Esteban Küber
9616b333b2 review comment: tweak wording 2019-06-01 14:47:15 -07:00
Esteban Küber
ebbe725dd0 Tweak wording 2019-05-31 20:48:09 -07:00
Esteban Küber
74fb3bbee4 On type inference errors use the type argument name when possible
```
error[E0282]: type annotations needed in `std::result::Result<i32, E>`
 --> file7.rs:3:13
  |
3 |     let b = Ok(4);
  |         -   ^^ cannot infer type for `E` in `std::result::Result<i32, E>`
  |         |
  |         consider giving `b` a type`
```
2019-05-31 18:33:59 -07:00
Esteban Küber
65c2a7b18b Alternative wording for inference failure 2019-05-31 18:33:59 -07:00
Esteban Küber
8bb094dac5 Add more detail to type inference error
When encountering code where type inference fails, add more actionable
information:

```
fn main() {
    let foo = Vec::new();
}
```

```
error[E0282]: type annotations needed for `std::vec::Vec<_>`
  --> $DIR/vector-no-ann.rs:2:16
   |
LL |     let foo = Vec::new();
   |         ---   ^^^^^^^^ cannot infer type for `T`
   |         |
   |         consider giving `foo` the type `std::vec::Vec<_>` with the type parameter `T` specified
```

We still need to modify type printing to optionally accept a
`TypeVariableTable` in order to properly print `std::vec::Vec<T>`.

CC #25633.
2019-05-31 18:33:59 -07:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
David Wood
3fc7ab2373
Merged migrated compile-fail tests and ui tests. Fixes #46841. 2018-08-14 11:12:09 +02:00