about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-12-30 17:57:36 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-01-03 14:02:01 -0800
commitdf13c64c3b221f0408fa7e149884e25ff5b02343 (patch)
tree4c5bf35417e6a5f96c6f254d41cbc1f89cf6d991
parent65d55afd2f94cb6cd8d66e767a52bc99a1569341 (diff)
downloadrust-df13c64c3b221f0408fa7e149884e25ff5b02343.tar.gz
rust-df13c64c3b221f0408fa7e149884e25ff5b02343.zip
test: Get rid of some `@mut`s in borrow check tests
-rw-r--r--src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs8
-rw-r--r--src/test/compile-fail/borrowck-loan-rcvr.rs11
-rw-r--r--src/test/compile-fail/borrowck-mut-boxed-vec.rs18
-rw-r--r--src/test/compile-fail/borrowck-mut-deref-comp.rs2
-rw-r--r--src/test/compile-fail/borrowck-object-mutability.rs5
-rw-r--r--src/test/run-pass/borrowck-root-while-cond-2.rs2
-rw-r--r--src/test/run-pass/borrowck-root-while-cond.rs2
7 files changed, 3 insertions, 45 deletions
diff --git a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
index bfc1884ac5a..9d628c1f6c7 100644
--- a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
+++ b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
@@ -49,13 +49,5 @@ fn b() {
     q.x += 1; // and OK to mutate it
 }
 
-fn c() {
-    // Here the receiver is in aliased memory but due to write
-    // barriers we can still consider it immutable.
-    let q = @mut Point {x: 3, y: 4};
-    *q + 3;
-    q.times(3);
-}
-
 fn main() {
 }
diff --git a/src/test/compile-fail/borrowck-loan-rcvr.rs b/src/test/compile-fail/borrowck-loan-rcvr.rs
index 5c6f7082ed0..a0071938ce4 100644
--- a/src/test/compile-fail/borrowck-loan-rcvr.rs
+++ b/src/test/compile-fail/borrowck-loan-rcvr.rs
@@ -48,16 +48,5 @@ fn b() {
     l.x += 1;
 }
 
-fn c() {
-    // Loaning @mut as & is considered legal due to dynamic checks...
-    let q = @mut point {x: 3, y: 4};
-    q.impurem();
-
-    // ...but we still detect errors statically when we can.
-    q.blockm(|| {
-        q.x = 10; //~ ERROR cannot assign
-    })
-}
-
 fn main() {
 }
diff --git a/src/test/compile-fail/borrowck-mut-boxed-vec.rs b/src/test/compile-fail/borrowck-mut-boxed-vec.rs
deleted file mode 100644
index 84c2db8bd57..00000000000
--- a/src/test/compile-fail/borrowck-mut-boxed-vec.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-fn main() {
-    let v = @mut [ 1, 2, 3 ];
-    for _x in v.iter() {
-        v[1] = 4; //~ ERROR cannot assign
-    }
-}
diff --git a/src/test/compile-fail/borrowck-mut-deref-comp.rs b/src/test/compile-fail/borrowck-mut-deref-comp.rs
index 7cf2e57ab80..77318e6a636 100644
--- a/src/test/compile-fail/borrowck-mut-deref-comp.rs
+++ b/src/test/compile-fail/borrowck-mut-deref-comp.rs
@@ -12,7 +12,7 @@
 
 struct foo(~int);
 
-fn borrow(x: @mut foo) {
+fn borrow(x: @foo) {
     let _y = &***x;
     *x = foo(~4); //~ ERROR cannot assign
 }
diff --git a/src/test/compile-fail/borrowck-object-mutability.rs b/src/test/compile-fail/borrowck-object-mutability.rs
index e6cb8d62d04..1d1b993f5d1 100644
--- a/src/test/compile-fail/borrowck-object-mutability.rs
+++ b/src/test/compile-fail/borrowck-object-mutability.rs
@@ -30,11 +30,6 @@ fn managed_receiver(x: @Foo) {
     x.borrowed_mut(); //~ ERROR cannot borrow
 }
 
-fn managed_mut_receiver(x: @mut Foo) {
-    x.borrowed();
-    x.borrowed_mut();
-}
-
 fn owned_receiver(x: ~Foo) {
     x.borrowed();
     x.borrowed_mut(); //~ ERROR cannot borrow
diff --git a/src/test/run-pass/borrowck-root-while-cond-2.rs b/src/test/run-pass/borrowck-root-while-cond-2.rs
index 19b87584e2d..9511d1b40e6 100644
--- a/src/test/run-pass/borrowck-root-while-cond-2.rs
+++ b/src/test/run-pass/borrowck-root-while-cond-2.rs
@@ -14,6 +14,6 @@ struct F { f: @G }
 struct G { g: ~[int] }
 
 pub fn main() {
-    let rec = @mut F {f: @G {g: ~[1, 2, 3]}};
+    let rec = @F {f: @G {g: ~[1, 2, 3]}};
     while rec.f.g.len() == 23 {}
 }
diff --git a/src/test/run-pass/borrowck-root-while-cond.rs b/src/test/run-pass/borrowck-root-while-cond.rs
index 35ab64584f5..a2d4991abc0 100644
--- a/src/test/run-pass/borrowck-root-while-cond.rs
+++ b/src/test/run-pass/borrowck-root-while-cond.rs
@@ -15,6 +15,6 @@ fn borrow<'r,T>(x: &'r T) -> &'r T {x}
 struct Rec { f: @int }
 
 pub fn main() {
-    let rec = @mut Rec {f: @22};
+    let rec = @Rec {f: @22};
     while *borrow(rec.f) == 23 {}
 }