File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
compiler/rustc_typeck/src/check Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -1461,16 +1461,10 @@ fn restrict_capture_precision<'tcx>(mut place: Place<'tcx>) -> Place<'tcx> {
14611461
14621462/// Truncates a place so that the resultant capture doesn't move data out of a reference
14631463fn truncate_capture_for_move ( mut place : Place < ' tcx > ) -> Place < ' tcx > {
1464- for ( i, proj) in place. projections . iter ( ) . enumerate ( ) {
1465- match proj. kind {
1466- ProjectionKind :: Deref => {
1467- // We only drop Derefs in case of move closures
1468- // There might be an index projection or raw ptr ahead, so we don't stop here.
1469- place. projections . truncate ( i) ;
1470- return place;
1471- }
1472- _ => { }
1473- }
1464+ if let Some ( i) = place. projections . iter ( ) . position ( |proj| proj. kind == ProjectionKind :: Deref ) {
1465+ // We only drop Derefs in case of move closures
1466+ // There might be an index projection or raw ptr ahead, so we don't stop here.
1467+ place. projections . truncate ( i) ;
14741468 }
14751469
14761470 place
You can’t perform that action at this time.
0 commit comments