@@ -870,34 +870,16 @@ impl<'a> CheckLoanCtxt<'a> {
870
870
// here is to `v[*]`, and the existing restrictions were issued
871
871
// for `v`, not `v[*]`.
872
872
//
873
- // So in this loop, we walk back up the loan path so long
874
- // as the mutability of the path is dependent on a super
875
- // path, and check that the super path was not borrowed.
876
- //
877
- // Mutability of a path can be dependent on the super path
878
- // in two ways. First, it might be inherited mutability.
879
- // Second, the pointee of an `&mut` pointer can only be
880
- // mutated if it is found in an unaliased location, so we
881
- // have to check that the owner location is not borrowed.
873
+ // So in this loop, we walk back up the path and look for
874
+ // loans, not restrictions.
882
875
883
876
let full_loan_path = loan_path. clone ( ) ;
884
877
let mut loan_path = loan_path;
885
878
loop {
886
879
loan_path = match * loan_path {
887
- // Peel back one layer if, for `loan_path` to be
888
- // mutable, `lp_base` must be mutable. This occurs
889
- // with inherited mutability, owned pointers and
890
- // `&mut` pointers.
891
- LpExtend ( ref lp_base, mc:: McInherited , _) |
892
- LpExtend ( ref lp_base, _, LpDeref ( mc:: OwnedPtr ) ) |
893
- LpExtend ( ref lp_base, _, LpDeref ( mc:: GcPtr ) ) |
894
- LpExtend ( ref lp_base, _, LpDeref ( mc:: BorrowedPtr ( ty:: MutBorrow , _) ) ) => {
880
+ LpExtend ( ref lp_base, _, _) => {
895
881
lp_base. clone ( )
896
882
}
897
-
898
- // Otherwise stop iterating
899
- LpExtend ( _, mc:: McDeclared , _) |
900
- LpExtend ( _, mc:: McImmutable , _) |
901
883
LpVar ( _) => {
902
884
return ;
903
885
}
0 commit comments