@@ -1205,18 +1205,19 @@ macro_rules! visit_place_fns {
12051205 self . super_projection_elem( place_ref, elem, context, location) ;
12061206 }
12071207
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+ } ;
12201221 }
12211222
12221223 self . visit_local( place. local, context, location) ;
@@ -1239,7 +1240,7 @@ macro_rules! visit_place_fns {
12391240 & mut self ,
12401241 _place_ref: PlaceRef <' tcx>,
12411242 elem: PlaceElem <' tcx>,
1242- _context : PlaceContext ,
1243+ context : PlaceContext ,
12431244 location: Location ,
12441245 ) {
12451246 match elem {
@@ -1252,7 +1253,12 @@ macro_rules! visit_place_fns {
12521253 ProjectionElem :: Index ( local) => {
12531254 self . visit_local(
12541255 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+ } ,
12561262 location,
12571263 ) ;
12581264 }
0 commit comments