From b9d3f654128ce6ba29e1e9ff31fcc44f2f04b59f Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Tue, 30 Aug 2022 15:17:45 -0700 Subject: [drop tracking] Use parent expression for scope Previously we were just using the parent node as the scope for a temporary value, but it turns out this is too narrow. For example, in an expression like Foo { b: &42, a: async { 0 }.await, } the scope for the &42 was set to the ExprField node for `b: &42`, when we actually want to use the Foo struct expression. We fix this by recursively searching through parent nodes until we find a Node::Expr. It may be that we don't find one, and if so that's okay, we will just fall back on the enclosing temporary scope which is always sufficient. --- src/test/ui/async-await/issue-73137.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/test') diff --git a/src/test/ui/async-await/issue-73137.rs b/src/test/ui/async-await/issue-73137.rs index c43ce2cadba..dcbe7765a9e 100644 --- a/src/test/ui/async-await/issue-73137.rs +++ b/src/test/ui/async-await/issue-73137.rs @@ -2,6 +2,9 @@ // run-pass // edition:2018 +// revisions: normal drop-tracking +// [normal]compile-flags: -Zdrop-tracking=no +// [drop-tracking]compile-flags: -Zdrop-tracking #![allow(dead_code)] use std::future::Future; -- cgit 1.4.1-3-g733a5