Skip to content

Commit 1f02e28

Browse files
author
Cameron Zwarich
committed
---
yaml --- r: 152589 b: refs/heads/try2 c: 69f4839 h: refs/heads/master i: 152587: fee0754 v: v3
1 parent 09729bd commit 1f02e28

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 178c4fbccbc59fc7c554cb3cda33413d7d455366
8+
refs/heads/try2: 69f4839b926d6435df83cd80945d9f843cf60e27
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -870,34 +870,16 @@ impl<'a> CheckLoanCtxt<'a> {
870870
// here is to `v[*]`, and the existing restrictions were issued
871871
// for `v`, not `v[*]`.
872872
//
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.
882875

883876
let full_loan_path = loan_path.clone();
884877
let mut loan_path = loan_path;
885878
loop {
886879
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, _, _) => {
895881
lp_base.clone()
896882
}
897-
898-
// Otherwise stop iterating
899-
LpExtend(_, mc::McDeclared, _) |
900-
LpExtend(_, mc::McImmutable, _) |
901883
LpVar(_) => {
902884
return;
903885
}

0 commit comments

Comments
 (0)