From d67db0042c1f4e163292ea59bdfac546c67f7001 Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Tue, 18 Jun 2019 14:34:51 -0700 Subject: 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. --- src/test/ui/async-await/unresolved_type_param.rs | 4 ++-- src/test/ui/async-await/unresolved_type_param.stderr | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/test') diff --git a/src/test/ui/async-await/unresolved_type_param.rs b/src/test/ui/async-await/unresolved_type_param.rs index 77174b03217..578d41fe0df 100644 --- a/src/test/ui/async-await/unresolved_type_param.rs +++ b/src/test/ui/async-await/unresolved_type_param.rs @@ -7,9 +7,9 @@ async fn bar() -> () {} 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() {} diff --git a/src/test/ui/async-await/unresolved_type_param.stderr b/src/test/ui/async-await/unresolved_type_param.stderr index afb9adf4c77..f3090a2b980 100644 --- a/src/test/ui/async-await/unresolved_type_param.stderr +++ b/src/test/ui/async-await/unresolved_type_param.stderr @@ -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; -- cgit 1.4.1-3-g733a5