Skip to content

Commit df13c64

Browse files
committed
test: Get rid of some @muts in borrow check tests
1 parent 65d55af commit df13c64

7 files changed

+3
-45
lines changed

src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,5 @@ fn b() {
4949
q.x += 1; // and OK to mutate it
5050
}
5151

52-
fn c() {
53-
// Here the receiver is in aliased memory but due to write
54-
// barriers we can still consider it immutable.
55-
let q = @mut Point {x: 3, y: 4};
56-
*q + 3;
57-
q.times(3);
58-
}
59-
6052
fn main() {
6153
}

src/test/compile-fail/borrowck-loan-rcvr.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,5 @@ fn b() {
4848
l.x += 1;
4949
}
5050

51-
fn c() {
52-
// Loaning @mut as & is considered legal due to dynamic checks...
53-
let q = @mut point {x: 3, y: 4};
54-
q.impurem();
55-
56-
// ...but we still detect errors statically when we can.
57-
q.blockm(|| {
58-
q.x = 10; //~ ERROR cannot assign
59-
})
60-
}
61-
6251
fn main() {
6352
}

src/test/compile-fail/borrowck-mut-boxed-vec.rs

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

src/test/compile-fail/borrowck-mut-deref-comp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
struct foo(~int);
1414

15-
fn borrow(x: @mut foo) {
15+
fn borrow(x: @foo) {
1616
let _y = &***x;
1717
*x = foo(~4); //~ ERROR cannot assign
1818
}

src/test/compile-fail/borrowck-object-mutability.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ fn managed_receiver(x: @Foo) {
3030
x.borrowed_mut(); //~ ERROR cannot borrow
3131
}
3232

33-
fn managed_mut_receiver(x: @mut Foo) {
34-
x.borrowed();
35-
x.borrowed_mut();
36-
}
37-
3833
fn owned_receiver(x: ~Foo) {
3934
x.borrowed();
4035
x.borrowed_mut(); //~ ERROR cannot borrow

src/test/run-pass/borrowck-root-while-cond-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ struct F { f: @G }
1414
struct G { g: ~[int] }
1515

1616
pub fn main() {
17-
let rec = @mut F {f: @G {g: ~[1, 2, 3]}};
17+
let rec = @F {f: @G {g: ~[1, 2, 3]}};
1818
while rec.f.g.len() == 23 {}
1919
}

src/test/run-pass/borrowck-root-while-cond.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ fn borrow<'r,T>(x: &'r T) -> &'r T {x}
1515
struct Rec { f: @int }
1616

1717
pub fn main() {
18-
let rec = @mut Rec {f: @22};
18+
let rec = @Rec {f: @22};
1919
while *borrow(rec.f) == 23 {}
2020
}

0 commit comments

Comments
 (0)