@@ -1205,18 +1205,19 @@ macro_rules! visit_place_fns {
1205
1205
self . super_projection_elem( place_ref, elem, context, location) ;
1206
1206
}
1207
1207
1208
- fn super_place( & mut self , place: & Place <' tcx>, context: PlaceContext , location: Location ) {
1209
- let mut context = context;
1210
-
1211
- if !place. projection. is_empty( ) {
1212
- if context. is_use( ) {
1213
- // ^ Only change the context if it is a real use, not a "use" in debuginfo.
1214
- context = if context. is_mutating_use( ) {
1215
- PlaceContext :: MutatingUse ( MutatingUseContext :: Projection )
1216
- } else {
1217
- PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Projection )
1218
- } ;
1219
- }
1208
+ fn super_place(
1209
+ & mut self ,
1210
+ place: & Place <' tcx>,
1211
+ mut context: PlaceContext ,
1212
+ location: Location ,
1213
+ ) {
1214
+ if !place. projection. is_empty( ) && context. is_use( ) {
1215
+ // ^ Only change the context if it is a real use, not a "use" in debuginfo.
1216
+ context = if context. is_mutating_use( ) {
1217
+ PlaceContext :: MutatingUse ( MutatingUseContext :: Projection )
1218
+ } else {
1219
+ PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Projection )
1220
+ } ;
1220
1221
}
1221
1222
1222
1223
self . visit_local( place. local, context, location) ;
@@ -1239,7 +1240,7 @@ macro_rules! visit_place_fns {
1239
1240
& mut self ,
1240
1241
_place_ref: PlaceRef <' tcx>,
1241
1242
elem: PlaceElem <' tcx>,
1242
- _context : PlaceContext ,
1243
+ context : PlaceContext ,
1243
1244
location: Location ,
1244
1245
) {
1245
1246
match elem {
@@ -1252,7 +1253,12 @@ macro_rules! visit_place_fns {
1252
1253
ProjectionElem :: Index ( local) => {
1253
1254
self . visit_local(
1254
1255
local,
1255
- PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) ,
1256
+ if context. is_use( ) {
1257
+ // ^ Only change the context if it is a real use, not a "use" in debuginfo.
1258
+ PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy )
1259
+ } else {
1260
+ context
1261
+ } ,
1256
1262
location,
1257
1263
) ;
1258
1264
}
0 commit comments