]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #67285 - ohadravid:indicate-origin-of-where-type-parameter, r=estebank
authorMazdak Farrokhzad <twingoow@gmail.com>
Fri, 20 Dec 2019 11:17:23 +0000 (12:17 +0100)
committerGitHub <noreply@github.com>
Fri, 20 Dec 2019 11:17:23 +0000 (12:17 +0100)
Indicate origin of where type parameter for uninferred types

Based on #65951 (which is not merge yet), fixes #67277.

This PR improves a little the diagnostic for code like:

```
 async fn foo() {
     bar().await;
}

 async fn bar<T>() -> () {}
```

by showing:
```
error[E0698]: type inside `async fn` body must be known in this context
 --> unresolved_type_param.rs:9:5
  |
9 |     bar().await;
  |     ^^^ cannot infer type for type parameter `T` declared on the function `bar`
  |
...
```
(The
```
declared on the function `bar`
```
part is new)

A small side note: `Vec` and `slice` seem to resist this change, because querying `item_name()` panics, and `get_opt_name()` returns `None`.

r? @estebank

1  2 
src/librustc/traits/error_reporting.rs