Skip to content

Commit 6990fa5

Browse files
committed
---
yaml --- r: 60787 b: refs/heads/auto c: e35db1a h: refs/heads/master i: 60785: 18cba4c 60783: d18a782 v: v3
1 parent 111157c commit 6990fa5

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: bf1647c92a868d49709e3bbbe66d4f2a46e97595
17+
refs/heads/auto: e35db1ab35caf9318080ef293135546af5661172
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,12 +657,12 @@ fn check_loans_in_fn<'a>(fk: &visit::fn_kind,
657657
let move_err = this.analyze_move_out_from_cmt(cmt);
658658
match move_err {
659659
MoveOk => {}
660-
MoveWhileBorrowed(loan_path, loan_span) => {
660+
MoveWhileBorrowed(move_path, loan_path, loan_span) => {
661661
this.bccx.span_err(
662662
cap_var.span,
663663
fmt!("cannot move `%s` into closure \
664664
because it is borrowed",
665-
this.bccx.loan_path_to_str(loan_path)));
665+
this.bccx.loan_path_to_str(move_path)));
666666
this.bccx.span_note(
667667
loan_span,
668668
fmt!("borrow of `%s` occurs here",

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn compute_restrictions(bccx: @BorrowckCtxt,
3333
cmt_original: cmt
3434
};
3535

36-
ctxt.compute(cmt, restr)
36+
ctxt.restrict(cmt, restr)
3737
}
3838

3939
///////////////////////////////////////////////////////////////////////////
@@ -50,9 +50,9 @@ impl RestrictionsContext {
5050
self.bccx.tcx
5151
}
5252

53-
fn compute(&self,
54-
cmt: mc::cmt,
55-
restrictions: RestrictionSet) -> RestrictionResult {
53+
fn restrict(&self,
54+
cmt: mc::cmt,
55+
restrictions: RestrictionSet) -> RestrictionResult {
5656

5757
// Check for those cases where we cannot control the aliasing
5858
// and make sure that we are not being asked to.
@@ -86,7 +86,9 @@ impl RestrictionsContext {
8686
// When we borrow the interior of an enum, we have to
8787
// ensure the enum itself is not mutated, because that
8888
// could cause the type of the memory to change.
89-
self.compute(cmt_base, restrictions | RESTR_MUTATE | RESTR_CLAIM)
89+
self.restrict(
90+
cmt_base,
91+
restrictions | RESTR_MUTATE | RESTR_CLAIM)
9092
}
9193

9294
mc::cat_interior(cmt_base, i) => {
@@ -95,7 +97,7 @@ impl RestrictionsContext {
9597
// Overwriting the base would not change the type of
9698
// the memory, so no additional restrictions are
9799
// needed.
98-
let result = self.compute(cmt_base, restrictions);
100+
let result = self.restrict(cmt_base, restrictions);
99101
self.extend(result, cmt.mutbl, LpInterior(i), restrictions)
100102
}
101103

@@ -105,7 +107,7 @@ impl RestrictionsContext {
105107
// When we borrow the interior of an owned pointer, we
106108
// cannot permit the base to be mutated, because that
107109
// would cause the unique pointer to be freed.
108-
let result = self.compute(
110+
let result = self.restrict(
109111
cmt_base,
110112
restrictions | RESTR_MUTATE | RESTR_CLAIM);
111113
self.extend(result, cmt.mutbl, LpDeref, restrictions)
@@ -180,16 +182,15 @@ impl RestrictionsContext {
180182
// mutability, we can only prevent mutation or prevent
181183
// freezing if it is not aliased. Therefore, in such
182184
// cases we restrict aliasing on `cmt_base`.
183-
if restrictions.intersects(RESTR_MUTATE |
184-
RESTR_CLAIM |
185-
RESTR_FREEZE) {
185+
if restrictions != RESTR_EMPTY {
186186
// R-Deref-Mut-Borrowed-1
187-
let result = self.compute(cmt_base, restrictions | RESTR_ALIAS);
187+
let result = self.restrict(
188+
cmt_base,
189+
RESTR_ALIAS | RESTR_MUTATE | RESTR_CLAIM);
188190
self.extend(result, cmt.mutbl, LpDeref, restrictions)
189191
} else {
190192
// R-Deref-Mut-Borrowed-2
191-
let result = self.compute(cmt_base, restrictions);
192-
self.extend(result, cmt.mutbl, LpDeref, restrictions)
193+
Safe
193194
}
194195
}
195196

@@ -200,7 +201,7 @@ impl RestrictionsContext {
200201

201202
mc::cat_stack_upvar(cmt_base) |
202203
mc::cat_discr(cmt_base, _) => {
203-
self.compute(cmt_base, restrictions)
204+
self.restrict(cmt_base, restrictions)
204205
}
205206
}
206207
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ pub struct Restriction {
315315
set: RestrictionSet
316316
}
317317

318+
#[deriving(Eq)]
318319
pub struct RestrictionSet {
319320
bits: u32
320321
}

0 commit comments

Comments
 (0)