You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#67285 - ohadravid:indicate-origin-of-where-type-parameter, r=estebank
Indicate origin of where type parameter for uninferred types
Based on rust-lang#65951 (which is not merge yet), fixesrust-lang#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
Copy file name to clipboardexpand all lines: src/test/ui/issues/issue-25368.stderr
+1-1
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ LL | let (tx, rx) = channel();
5
5
| -------- consider giving this pattern the explicit type `(std::sync::mpsc::Sender<Foo<T>>, std::sync::mpsc::Receiver<Foo<T>>)`, where the type parameter `T` is specified
6
6
...
7
7
LL | tx.send(Foo{ foo: PhantomData });
8
-
| ^^^ cannot infer type for type parameter `T`
8
+
| ^^^ cannot infer type for type parameter `T` declared on the struct `Foo`
0 commit comments