Skip to content

Commit 7db4c02

Browse files
committed
Revert "Count copies of locals as borrowed temporaries"
This reverts commit 0d270b5e9f48268735f9a05462df65c9d1039855.
1 parent d5b7205 commit 7db4c02

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,7 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
171171
.insert(TrackedValue::from_place_with_projections_allowed(place_with_id));
172172

173173
// For copied we treat this mostly like a borrow except that we don't add the place
174-
// to borrowed_temporaries if it is not a local because the copy is consumed.
175-
match place_with_id.place.base {
176-
PlaceBase::Rvalue | PlaceBase::StaticItem | PlaceBase::Upvar(_) => (),
177-
PlaceBase::Local(_) => {
178-
self.places.borrowed_temporaries.insert(place_with_id.hir_id);
179-
}
180-
}
174+
// to borrowed_temporaries because the copy is consumed.
181175
}
182176

183177
fn mutate(

src/test/ui/generator/drop-tracking-yielding-in-match-guards.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,8 @@
1414
#![feature(generators)]
1515

1616
fn main() {
17-
let _a = static |x: u8| match x {
17+
let _ = static |x: u8| match x {
1818
y if { yield } == y + 1 => (),
1919
_ => (),
2020
};
21-
22-
static STATIC: u8 = 42;
23-
let _b = static |x: u8| match x {
24-
y if { yield } == STATIC + 1 => (),
25-
_ => (),
26-
};
27-
28-
let upvar = 42u8;
29-
let _c = static |x: u8| match x {
30-
y if { yield } == upvar + 1 => (),
31-
_ => (),
32-
};
3321
}

0 commit comments

Comments
 (0)