Skip to content

Commit 1ca2554

Browse files
author
Cameron Zwarich
committed
---
yaml --- r: 152585 b: refs/heads/try2 c: e018fc3 h: refs/heads/master i: 152583: 52fd3e4 v: v3
1 parent 4ab473a commit 1ca2554

File tree

5 files changed

+12
-22
lines changed

5 files changed

+12
-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: 59309e0d9bf3eba0f4219062b451ff10cbdf0e2b
8+
refs/heads/try2: e018fc36d17685c31d6b31acf17a9a8f2f73f8d9
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ impl<'a> CheckLoanCtxt<'a> {
208208
loan.repr(self.tcx()));
209209

210210
let mut ret = true;
211-
for restr in loan.restrictions.iter() {
212-
if *restr.loan_path == *loan_path {
211+
for restr_path in loan.restricted_paths.iter() {
212+
if **restr_path == *loan_path {
213213
if !op(loan) {
214214
ret = false;
215215
break;
@@ -298,8 +298,8 @@ impl<'a> CheckLoanCtxt<'a> {
298298
return true;
299299
}
300300

301-
for restr in loan1.restrictions.iter() {
302-
if restr.loan_path != loan2.loan_path { continue; }
301+
for restr_path in loan1.restricted_paths.iter() {
302+
if *restr_path != loan2.loan_path { continue; }
303303

304304
let old_pronoun = if new_loan.loan_path == old_loan.loan_path {
305305
"it".to_string()

branches/try2/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl<'a> GatherLoanCtxt<'a> {
268268
return;
269269
}
270270

271-
restrictions::SafeIf(loan_path, restrictions) => {
271+
restrictions::SafeIf(loan_path, restricted_paths) => {
272272
let loan_scope = match loan_region {
273273
ty::ReScope(id) => id,
274274
ty::ReFree(ref fr) => fr.scope_id,
@@ -314,7 +314,7 @@ impl<'a> GatherLoanCtxt<'a> {
314314
gen_scope: gen_scope,
315315
kill_scope: kill_scope,
316316
span: borrow_span,
317-
restrictions: restrictions,
317+
restricted_paths: restricted_paths,
318318
cause: cause,
319319
}
320320
}

branches/try2/src/librustc/middle/borrowck/gather_loans/restrictions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::rc::Rc;
2323

2424
pub enum RestrictionResult {
2525
Safe,
26-
SafeIf(Rc<LoanPath>, Vec<Restriction>)
26+
SafeIf(Rc<LoanPath>, Vec<Rc<LoanPath>>)
2727
}
2828

2929
pub fn compute_restrictions(bccx: &BorrowckCtxt,
@@ -71,7 +71,7 @@ impl<'a> RestrictionsContext<'a> {
7171
mc::cat_upvar(ty::UpvarId {var_id: local_id, ..}, _) => {
7272
// R-Variable
7373
let lp = Rc::new(LpVar(local_id));
74-
SafeIf(lp.clone(), vec!(Restriction { loan_path: lp }))
74+
SafeIf(lp.clone(), vec!(lp))
7575
}
7676

7777
mc::cat_downcast(cmt_base) => {
@@ -164,7 +164,7 @@ impl<'a> RestrictionsContext<'a> {
164164
Safe => Safe,
165165
SafeIf(base_lp, mut base_vec) => {
166166
let lp = Rc::new(LpExtend(base_lp, mc, elem));
167-
base_vec.push(Restriction { loan_path: lp.clone() });
167+
base_vec.push(lp.clone());
168168
SafeIf(lp, base_vec)
169169
}
170170
}

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub struct Loan {
181181
index: uint,
182182
loan_path: Rc<LoanPath>,
183183
kind: ty::BorrowKind,
184-
restrictions: Vec<Restriction>,
184+
restricted_paths: Vec<Rc<LoanPath>>,
185185
gen_scope: ast::NodeId,
186186
kill_scope: ast::NodeId,
187187
span: Span,
@@ -249,10 +249,6 @@ pub fn opt_loan_path(cmt: &mc::cmt) -> Option<Rc<LoanPath>> {
249249
}
250250
}
251251

252-
pub struct Restriction {
253-
loan_path: Rc<LoanPath>,
254-
}
255-
256252
///////////////////////////////////////////////////////////////////////////
257253
// Errors
258254

@@ -777,13 +773,7 @@ impl Repr for Loan {
777773
self.kind,
778774
self.gen_scope,
779775
self.kill_scope,
780-
self.restrictions.repr(tcx))).to_string()
781-
}
782-
}
783-
784-
impl Repr for Restriction {
785-
fn repr(&self, tcx: &ty::ctxt) -> String {
786-
(format!("Restriction({})", self.loan_path.repr(tcx))).to_string()
776+
self.restricted_paths.repr(tcx))).to_string()
787777
}
788778
}
789779

0 commit comments

Comments
 (0)