@@ -948,7 +948,7 @@ fn truncate_projections_for_capture<'tcx>(
948
948
let mut first_index_projection = None ;
949
949
let mut first_deref_projection = None ;
950
950
let mut first_raw_ptr = None ;
951
- // let mut last_field_projection = None;
951
+ let mut last_field_projection = None ;
952
952
953
953
for ( i, proj) in place. projections . iter ( ) . enumerate ( ) {
954
954
if proj. ty . is_unsafe_ptr ( ) {
@@ -968,7 +968,7 @@ fn truncate_projections_for_capture<'tcx>(
968
968
first_deref_projection. get_or_insert ( i) ;
969
969
}
970
970
ProjectionKind :: Field ( ..) => {
971
- // last_field_projection = Some(i);
971
+ last_field_projection = Some ( i) ;
972
972
}
973
973
ProjectionKind :: Subslice => { } // We never capture this
974
974
}
@@ -990,11 +990,9 @@ fn truncate_projections_for_capture<'tcx>(
990
990
ty:: UpvarCapture :: ByRef ( ..) => length,
991
991
} ;
992
992
993
- //if env::var("SG_DROP_DEREFS").is_ok() {
994
- //// Since we will only have Field and Deref projections at this point.
995
- //// This will truncate trailing derefs.
996
- //length = last_field_projection.map_or(length, |idx| cmp::min(length, idx + 1));
997
- //}
993
+ // Since we will only have Field and Deref projections at this point.
994
+ // This will truncate trailing derefs.
995
+ length = last_field_projection. map_or ( length, |idx| cmp:: min ( length, idx + 1 ) ) ;
998
996
999
997
place. projections . truncate ( length) ;
1000
998
0 commit comments