@@ -150,9 +150,9 @@ pub fn check_loans(bccx: &BorrowckCtxt,
150
150
}
151
151
152
152
#[ deriving( PartialEq ) ]
153
- enum MoveError {
154
- MoveOk ,
155
- MoveWhileBorrowed ( /*loan*/ Rc < LoanPath > , /*loan*/ Span )
153
+ enum UseError {
154
+ UseOk ,
155
+ UseWhileBorrowed ( /*loan*/ Rc < LoanPath > , /*loan*/ Span )
156
156
}
157
157
158
158
impl < ' a > CheckLoanCtxt < ' a > {
@@ -479,9 +479,9 @@ impl<'a> CheckLoanCtxt<'a> {
479
479
// We want to detect if there are any loans at all, so we search for
480
480
// any loans incompatible with MutBorrrow, since all other kinds of
481
481
// loans are incompatible with that.
482
- match self . analyze_move_out_from ( id, move_path, ty:: MutBorrow ) {
483
- MoveOk => { }
484
- MoveWhileBorrowed ( loan_path, loan_span) => {
482
+ match self . analyze_restrictions_on_use ( id, move_path, ty:: MutBorrow ) {
483
+ UseOk => { }
484
+ UseWhileBorrowed ( loan_path, loan_span) => {
485
485
let err_message = match move_kind {
486
486
move_data:: Captured =>
487
487
format ! ( "cannot move `{}` into closure because it is borrowed" ,
@@ -866,16 +866,16 @@ impl<'a> CheckLoanCtxt<'a> {
866
866
self . bccx. loan_path_to_str( loan_path) ) . as_slice ( ) ) ;
867
867
}
868
868
869
- pub fn analyze_move_out_from ( & self ,
870
- expr_id : ast:: NodeId ,
871
- move_path : & LoanPath ,
872
- borrow_kind : ty:: BorrowKind )
873
- -> MoveError {
874
- debug ! ( "analyze_move_out_from (expr_id={:?}, move_path ={})" ,
869
+ pub fn analyze_restrictions_on_use ( & self ,
870
+ expr_id : ast:: NodeId ,
871
+ use_path : & LoanPath ,
872
+ borrow_kind : ty:: BorrowKind )
873
+ -> UseError {
874
+ debug ! ( "analyze_restrictions_on_use (expr_id={:?}, use_path ={})" ,
875
875
self . tcx( ) . map. node_to_str( expr_id) ,
876
- move_path . repr( self . tcx( ) ) ) ;
876
+ use_path . repr( self . tcx( ) ) ) ;
877
877
878
- let mut ret = MoveOk ;
878
+ let mut ret = UseOk ;
879
879
880
880
// First, we check for a restriction on the path P being used. This
881
881
// accounts for borrows of P but also borrows of subpaths, like P.a.b.
@@ -884,9 +884,9 @@ impl<'a> CheckLoanCtxt<'a> {
884
884
// let x = &mut a.b.c; // Restricts a, a.b, and a.b.c
885
885
// let y = a; // Conflicts with restriction
886
886
887
- self . each_in_scope_restriction ( expr_id, move_path , |loan, _restr| {
887
+ self . each_in_scope_restriction ( expr_id, use_path , |loan, _restr| {
888
888
if incompatible ( loan. kind , borrow_kind) {
889
- ret = MoveWhileBorrowed ( loan. loan_path . clone ( ) , loan. span ) ;
889
+ ret = UseWhileBorrowed ( loan. loan_path . clone ( ) , loan. span ) ;
890
890
false
891
891
} else {
892
892
true
@@ -905,12 +905,12 @@ impl<'a> CheckLoanCtxt<'a> {
905
905
// let x = &mut a.b;
906
906
// let y = a.c;
907
907
908
- let mut loan_path = move_path ;
908
+ let mut loan_path = use_path ;
909
909
loop {
910
910
self . each_in_scope_loan ( expr_id, |loan| {
911
911
if * loan. loan_path == * loan_path &&
912
912
incompatible ( loan. kind , borrow_kind) {
913
- ret = MoveWhileBorrowed ( loan. loan_path . clone ( ) , loan. span ) ;
913
+ ret = UseWhileBorrowed ( loan. loan_path . clone ( ) , loan. span ) ;
914
914
false
915
915
} else {
916
916
true
0 commit comments