about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2022-05-17 15:04:05 -0700
committerEric Holk <ericholk@microsoft.com>2022-05-19 16:23:28 -0700
commit7db4c0277de996531c2e794ba16bb6746af65fef (patch)
tree00809d2479fd0bc48a9326bfaae66d23f0d090a5
parentd5b72058fe24834807c13991b580c712330ec806 (diff)
downloadrust-7db4c0277de996531c2e794ba16bb6746af65fef.tar.gz
rust-7db4c0277de996531c2e794ba16bb6746af65fef.zip
Revert "Count copies of locals as borrowed temporaries"
This reverts commit 0d270b5e9f48268735f9a05462df65c9d1039855.
-rw-r--r--compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs8
-rw-r--r--src/test/ui/generator/drop-tracking-yielding-in-match-guards.rs14
2 files changed, 2 insertions, 20 deletions
diff --git a/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs b/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs
index ec83acf08b7..e89a8961996 100644
--- a/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs
+++ b/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs
@@ -171,13 +171,7 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
             .insert(TrackedValue::from_place_with_projections_allowed(place_with_id));
 
         // For copied we treat this mostly like a borrow except that we don't add the place
-        // to borrowed_temporaries if it is not a local because the copy is consumed.
-        match place_with_id.place.base {
-            PlaceBase::Rvalue | PlaceBase::StaticItem | PlaceBase::Upvar(_) => (),
-            PlaceBase::Local(_) => {
-                self.places.borrowed_temporaries.insert(place_with_id.hir_id);
-            }
-        }
+        // to borrowed_temporaries because the copy is consumed.
     }
 
     fn mutate(
diff --git a/src/test/ui/generator/drop-tracking-yielding-in-match-guards.rs b/src/test/ui/generator/drop-tracking-yielding-in-match-guards.rs
index 9efe64a62e7..c818963e466 100644
--- a/src/test/ui/generator/drop-tracking-yielding-in-match-guards.rs
+++ b/src/test/ui/generator/drop-tracking-yielding-in-match-guards.rs
@@ -14,20 +14,8 @@
 #![feature(generators)]
 
 fn main() {
-    let _a = static |x: u8| match x {
+    let _ = static |x: u8| match x {
         y if { yield } == y + 1 => (),
         _ => (),
     };
-
-    static STATIC: u8 = 42;
-    let _b = static |x: u8| match x {
-        y if { yield } == STATIC + 1 => (),
-        _ => (),
-    };
-
-    let upvar = 42u8;
-    let _c = static |x: u8| match x {
-        y if { yield } == upvar + 1 => (),
-        _ => (),
-    };
 }