This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
compiler/rustc_typeck/src/check/generator_interior/drop_ranges Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,13 @@ 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 because the copy is consumed.
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+ }
175181 }
176182
177183 fn mutate (
Original file line number Diff line number Diff line change 1414#![ feature( generators) ]
1515
1616fn main ( ) {
17- let _ = static |x : u8 | match x {
17+ let _a = 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+ } ;
2133}
You can’t perform that action at this time.
0 commit comments