Skip to content

Commit a37cd17

Browse files
committed
---
yaml --- r: 151086 b: refs/heads/try2 c: aff620d h: refs/heads/master v: v3
1 parent 2a11b3b commit a37cd17

File tree

10 files changed

+17
-35
lines changed

10 files changed

+17
-35
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: d10735e3840b1bfcd52bf063258bc5db0c6e2a66
8+
refs/heads/try2: aff620de1e5e0791b7c91f765cf17f3214848230
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/driver/driver.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
348348
time(time_passes, "effect checking", (), |_|
349349
middle::effect::check_crate(&ty_cx, krate));
350350

351-
let middle::moves::MoveMaps {moves_map, moved_variables_set,
352-
capture_map} =
351+
let middle::moves::MoveMaps {moves_map, capture_map} =
353352
time(time_passes, "compute moves", (), |_|
354353
middle::moves::compute_moves(&ty_cx, krate));
355354

@@ -361,11 +360,9 @@ pub fn phase_3_run_analysis_passes(sess: Session,
361360

362361
time(time_passes, "borrow checking", (), |_|
363362
middle::borrowck::check_crate(&ty_cx, &moves_map,
364-
&moved_variables_set,
365363
&capture_map, krate));
366364

367365
drop(moves_map);
368-
drop(moved_variables_set);
369366

370367
time(time_passes, "kind checking", (), |_|
371368
kind::check_crate(&ty_cx, krate));

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,11 @@ impl<'a> Visitor<()> for BorrowckCtxt<'a> {
7777

7878
pub fn check_crate(tcx: &ty::ctxt,
7979
moves_map: &NodeSet,
80-
moved_variables_set: &NodeSet,
8180
capture_map: &moves::CaptureMap,
8281
krate: &ast::Crate) {
8382
let mut bccx = BorrowckCtxt {
8483
tcx: tcx,
8584
moves_map: moves_map,
86-
moved_variables_set: moved_variables_set,
8785
capture_map: capture_map,
8886
stats: @BorrowStats {
8987
loaned_paths_same: Cell::new(0),
@@ -168,7 +166,6 @@ fn borrowck_fn(this: &mut BorrowckCtxt,
168166
pub struct BorrowckCtxt<'a> {
169167
tcx: &'a ty::ctxt,
170168
moves_map: &'a NodeSet,
171-
moved_variables_set: &'a NodeSet,
172169
capture_map: &'a moves::CaptureMap,
173170

174171
// Statistics:

branches/try2/src/librustc/middle/moves.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ borrow checker and trans, for example, only care about the outermost
101101
expressions that are moved. It is more efficient therefore just to
102102
store those entries.
103103
104-
Sometimes though we want to know the variables that are moved (in
105-
particular in the borrow checker). For these cases, the set
106-
`moved_variables_set` just collects the ids of variables that are
107-
moved.
108-
109104
Finally, the `capture_map` maps from the node_id of a closure
110105
expression to an array of `CaptureVar` structs detailing which
111106
variables are captured and how (by ref, by copy, by move).
@@ -170,7 +165,6 @@ pub struct MoveMaps {
170165
* pub Note: The `moves_map` stores expression ids that are moves,
171166
* whereas this set stores the ids of the variables that are
172167
* moved at some point */
173-
pub moved_variables_set: NodeSet,
174168
pub capture_map: CaptureMap
175169
}
176170

@@ -206,7 +200,6 @@ pub fn compute_moves(tcx: &ty::ctxt, krate: &Crate) -> MoveMaps {
206200
tcx: tcx,
207201
move_maps: MoveMaps {
208202
moves_map: NodeSet::new(),
209-
moved_variables_set: NodeSet::new(),
210203
capture_map: NodeMap::new()
211204
}
212205
};
@@ -326,19 +319,6 @@ impl<'a> VisitContext<'a> {
326319
debug!("comp_mode = {:?}", comp_mode);
327320

328321
match expr.node {
329-
ExprPath(..) => {
330-
match comp_mode {
331-
Move => {
332-
let def = self.tcx.def_map.borrow().get_copy(&expr.id);
333-
let r = moved_variable_node_id_from_def(def);
334-
for &id in r.iter() {
335-
self.move_maps.moved_variables_set.insert(id);
336-
}
337-
}
338-
Read => {}
339-
}
340-
}
341-
342322
ExprUnary(UnDeref, base) => { // *base
343323
if !self.use_overloaded_operator(expr, base, []) {
344324
// Moving out of *base moves out of base.
@@ -475,6 +455,7 @@ impl<'a> VisitContext<'a> {
475455
self.use_expr(base, Read);
476456
}
477457

458+
ExprPath(..) |
478459
ExprInlineAsm(..) |
479460
ExprBreak(..) |
480461
ExprAgain(..) |

branches/try2/src/test/run-pass/borrowck-preserve-box-in-field.rs renamed to branches/try2/src/test/compile-fail/borrowck-preserve-box-in-field.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ struct F { f: ~int }
2626
pub fn main() {
2727
let mut x = @F {f: ~3};
2828
borrow(x.f, |b_x| {
29+
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
2930
assert_eq!(*b_x, 3);
3031
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
32+
//~^ NOTE borrow occurs due to use of `x` in closure
3133
x = @F {f: ~4};
3234

3335
println!("&*b_x = {:p}", &(*b_x));

branches/try2/src/test/run-pass/borrowck-preserve-box-in-uniq.rs renamed to branches/try2/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ struct F { f: ~int }
2626
pub fn main() {
2727
let mut x = ~@F{f: ~3};
2828
borrow(x.f, |b_x| {
29+
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
2930
assert_eq!(*b_x, 3);
3031
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
32+
//~^ NOTE borrow occurs due to use of `x` in closure
3133
*x = @F{f: ~4};
3234

3335
println!("&*b_x = {:p}", &(*b_x));

branches/try2/src/test/run-pass/borrowck-preserve-box.rs renamed to branches/try2/src/test/compile-fail/borrowck-preserve-box.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ fn borrow(x: &int, f: |x: &int|) {
2424
pub fn main() {
2525
let mut x = @3;
2626
borrow(x, |b_x| {
27+
//~^ ERROR cannot borrow `x` as mutable because `*x` is also borrowed as immutable
2728
assert_eq!(*b_x, 3);
2829
assert_eq!(&(*x) as *int, &(*b_x) as *int);
30+
//~^ NOTE borrow occurs due to use of `x` in closure
2931
x = @22;
3032

3133
println!("&*b_x = {:p}", &(*b_x));

branches/try2/src/test/run-pass/borrowck-preserve-cond-box.rs renamed to branches/try2/src/test/compile-fail/borrowck-preserve-cond-box.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ fn testfn(cond: bool) {
3030
println!("*r = {}, exp = {}", *r, exp);
3131
assert_eq!(*r, exp);
3232

33-
x = @5;
34-
y = @6;
33+
x = @5; //~ERROR cannot assign to `x` because it is borrowed
34+
y = @6; //~ERROR cannot assign to `y` because it is borrowed
3535

3636
println!("*r = {}, exp = {}", *r, exp);
3737
assert_eq!(*r, exp);

branches/try2/src/test/run-pass/borrowck-preserve-expl-deref.rs renamed to branches/try2/src/test/compile-fail/borrowck-preserve-expl-deref.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ struct F { f: ~int }
2626
pub fn main() {
2727
let mut x = @F {f: ~3};
2828
borrow((*x).f, |b_x| {
29+
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
2930
assert_eq!(*b_x, 3);
3031
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
32+
//~^ NOTE borrow occurs due to use of `x` in closure
3133
x = @F {f: ~4};
3234

3335
println!("&*b_x = {:p}", &(*b_x));

branches/try2/src/test/run-pass/regions-appearance-constraint.rs renamed to branches/try2/src/test/compile-fail/regions-appearance-constraint.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
/* Tests conditional rooting of the box y */
11+
// Test no-special rooting is used for managed boxes
1212

1313
#![feature(managed_boxes)]
1414

@@ -25,12 +25,11 @@ fn testfn(cond: bool) {
2525
exp = 4;
2626
}
2727

28-
x = @5;
29-
y = @6;
28+
x = @5; //~ERROR cannot assign to `x` because it is borrowed
29+
y = @6; //~ERROR cannot assign to `y` because it is borrowed
3030
assert_eq!(*a, exp);
3131
assert_eq!(x, @5);
3232
assert_eq!(y, @6);
3333
}
3434

35-
pub fn main() {
36-
}
35+
pub fn main() {}

0 commit comments

Comments
 (0)