about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
diff options
context:
space:
mode:
authorEsteban Kuber <esteban@kuber.com.ar>2021-11-16 22:06:25 +0000
committerEsteban Kuber <esteban@kuber.com.ar>2021-12-13 17:09:16 +0000
commitb825b0fe6333ff08552aefa1fb25dfdc932b8bca (patch)
treea9d8b7032ebd9843f759da46b97239a3a902ba1c /compiler/rustc_passes/src
parent8888d0d61e800654db4e1cd52e9e81dffb5c8ee2 (diff)
downloadrust-b825b0fe6333ff08552aefa1fb25dfdc932b8bca.tar.gz
rust-b825b0fe6333ff08552aefa1fb25dfdc932b8bca.zip
Fix rebase and clippy tests
Diffstat (limited to 'compiler/rustc_passes/src')
-rw-r--r--compiler/rustc_passes/src/region.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_passes/src/region.rs b/compiler/rustc_passes/src/region.rs
index ae423070392..8968c163987 100644
--- a/compiler/rustc_passes/src/region.rs
+++ b/compiler/rustc_passes/src/region.rs
@@ -421,11 +421,14 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
         // Mark this expr's scope and all parent scopes as containing `yield`.
         let mut scope = Scope { id: expr.hir_id.local_id, data: ScopeData::Node };
         loop {
-            let data = YieldData {
-                span: expr.span,
-                expr_and_pat_count: visitor.expr_and_pat_count,
-                source: *source,
+            let span = match expr.kind {
+                hir::ExprKind::Yield(expr, hir::YieldSource::Await { .. }) => {
+                    expr.span.shrink_to_hi().to(expr.span)
+                }
+                _ => expr.span,
             };
+            let data =
+                YieldData { span, expr_and_pat_count: visitor.expr_and_pat_count, source: *source };
             visitor.scope_tree.yield_in_scope.insert(scope, data);
             if visitor.pessimistic_yield {
                 debug!("resolve_expr in pessimistic_yield - marking scope {:?} for fixup", scope);