Skip to content

Commit 7b36e34

Browse files
committed
Fix two more write guard failures
1 parent 4300d4d commit 7b36e34

File tree

5 files changed

+45
-59
lines changed

5 files changed

+45
-59
lines changed

src/librustc/middle/resolve.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4825,10 +4825,12 @@ pub impl Resolver {
48254825

48264826
expr_loop(_, Some(label)) => {
48274827
do self.with_label_rib {
4828-
let this = &mut *self;
4829-
let def_like = dl_def(def_label(expr.id));
4830-
let rib = this.label_ribs[this.label_ribs.len() - 1];
4831-
rib.bindings.insert(label, def_like);
4828+
{
4829+
let this = &mut *self;
4830+
let def_like = dl_def(def_label(expr.id));
4831+
let rib = this.label_ribs[this.label_ribs.len() - 1];
4832+
rib.bindings.insert(label, def_like);
4833+
}
48324834

48334835
visit_expr(expr, (), visitor);
48344836
}

src/libsyntax/ext/pipes/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use ext::pipes::proto::{protocol_};
4242

4343
use std::bitv::Bitv;
4444

45-
pub fn analyze(proto: &mut protocol_, _cx: @ext_ctxt) {
45+
pub fn analyze(proto: @mut protocol_, _cx: @ext_ctxt) {
4646
debug!("initializing colive analysis");
4747
let num_states = proto.num_states();
4848
let mut colive = do (copy proto.states).map_to_vec |state| {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// error-pattern:borrowed
2+
3+
// Test that if you imm borrow then mut borrow it fails.
4+
5+
fn add1(a:@mut int)
6+
{
7+
add2(a); // already frozen
8+
}
9+
10+
fn add2(_:&mut int)
11+
{
12+
}
13+
14+
pub fn main()
15+
{
16+
let a = @mut 3;
17+
let b = &*a; // freezes a
18+
add1(a);
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// error-pattern:borrowed
2+
3+
// Test that if you mut borrow then imm borrow it fails.
4+
5+
fn add1(a:@mut int)
6+
{
7+
add2(a); // already frozen
8+
}
9+
10+
fn add2(_:&int)
11+
{
12+
}
13+
14+
pub fn main()
15+
{
16+
let a = @mut 3;
17+
let b = &mut *a; // freezes a
18+
add1(a);
19+
}

src/test/run-pass/regions-mock-trans-impls.rs

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)