File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed
src/librustc/middle/borrowck Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -874,23 +874,30 @@ impl<'a> CheckLoanCtxt<'a> {
874
874
// We must check every element of a move path. See
875
875
// `borrowck-move-subcomponent.rs` for a test case.
876
876
877
- // check for a conflicting loan:
878
877
let mut ret = MoveOk ;
879
- self . each_in_scope_restriction ( expr_id, move_path, |loan, _| {
880
- // Any restriction prevents moves.
881
- ret = MoveWhileBorrowed ( loan. loan_path . clone ( ) , loan. span ) ;
882
- false
883
- } ) ;
878
+ let mut loan_path = move_path;
879
+ loop {
880
+ // check for a conflicting loan:
881
+ self . each_in_scope_restriction ( expr_id, loan_path, |loan, _| {
882
+ // Any restriction prevents moves.
883
+ ret = MoveWhileBorrowed ( loan. loan_path . clone ( ) , loan. span ) ;
884
+ false
885
+ } ) ;
884
886
885
- if ret != MoveOk {
886
- return ret
887
- }
887
+ if ret != MoveOk {
888
+ return ret
889
+ }
888
890
889
- match * move_path {
890
- LpVar ( _) => MoveOk ,
891
- LpExtend ( ref subpath, _, _) => {
892
- self . analyze_move_out_from ( expr_id, & * * subpath)
891
+ match * loan_path {
892
+ LpVar ( _) => {
893
+ ret = MoveOk ;
894
+ break ;
895
+ }
896
+ LpExtend ( ref lp_base, _, _) => {
897
+ loan_path = & * * lp_base;
898
+ }
893
899
}
894
900
}
901
+ ret
895
902
}
896
903
}
You can’t perform that action at this time.
0 commit comments