Rollup merge of #61941 - cramertj:no-more-yield-errors, r=centril
Preserve generator and yield source for error messages Previously, error messages after HIR lowering all referred to generators and yield, regardless of whether the original source was a generator or an async/await body. This change tracks the kind of each generator and yield source in order to provide appropriately tailored error messages. Fixes #60615.
This commit is contained in:
commit
fde341a4ef
18 changed files with 221 additions and 128 deletions
|
|
@ -7,9 +7,9 @@ async fn bar<T>() -> () {}
|
|||
|
||||
async fn foo() {
|
||||
bar().await;
|
||||
//~^ ERROR type inside generator must be known in this context
|
||||
//~^ ERROR type inside `async` object must be known in this context
|
||||
//~| NOTE cannot infer type for `T`
|
||||
//~| NOTE the type is part of the generator because of this `yield`
|
||||
//~| NOTE the type is part of the `async` object because of this `await`
|
||||
//~| NOTE in this expansion of desugaring of `await`
|
||||
}
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0698]: type inside generator must be known in this context
|
||||
error[E0698]: type inside `async` object must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for `T`
|
||||
|
|
||||
note: the type is part of the generator because of this `yield`
|
||||
note: the type is part of the `async` object because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
|
|
||||
LL | bar().await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue