about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-12-30 17:50:53 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-01-03 14:02:01 -0800
commit179c054631c2b7aa6894c327698090e028def4ac (patch)
tree2434c3777f22320b7bda633d62822dd46167582e
parentb6e516859adc2eb0638a50677f73691f50ea9aca (diff)
downloadrust-179c054631c2b7aa6894c327698090e028def4ac.tar.gz
rust-179c054631c2b7aa6894c327698090e028def4ac.zip
test: Remove all borrow check write guard tests
-rw-r--r--src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs5
-rw-r--r--src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs7
-rw-r--r--src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs6
-rw-r--r--src/test/compile-fail/borrowck-wg-move-base-2.rs9
-rw-r--r--src/test/run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs23
-rw-r--r--src/test/run-fail/borrowck-wg-fail-2.rs17
-rw-r--r--src/test/run-fail/borrowck-wg-fail-3.rs13
-rw-r--r--src/test/run-fail/borrowck-wg-fail-object-arg.rs24
-rw-r--r--src/test/run-fail/borrowck-wg-fail-object.rs23
-rw-r--r--src/test/run-fail/borrowck-wg-fail.rs15
-rw-r--r--src/test/run-fail/borrowck-wg-imm-then-mut.rs21
-rw-r--r--src/test/run-fail/borrowck-wg-mut-then-imm.rs21
-rw-r--r--src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs39
-rw-r--r--src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs18
-rw-r--r--src/test/run-fail/borrowck-wg-one-mut-one-imm.rs19
-rw-r--r--src/test/run-fail/borrowck-wg-two-array-indices.rs19
-rw-r--r--src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs42
-rw-r--r--src/test/run-pass/borrowck-wg-borrow-mut-to-imm-2.rs13
-rw-r--r--src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs18
-rw-r--r--src/test/run-pass/borrowck-wg-borrow-mut-to-imm.rs12
-rw-r--r--src/test/run-pass/borrowck-wg-simple.rs10
-rw-r--r--src/test/run-pass/borrowck-wg-two-imm-borrows.rs16
22 files changed, 0 insertions, 390 deletions
diff --git a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs
deleted file mode 100644
index 451f023f5fc..00000000000
--- a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
-    let mut b = ~3;
-    let _x = &mut *b;
-    let _y = &mut *b; //~ ERROR cannot borrow
-}
diff --git a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs
deleted file mode 100644
index c455de888a3..00000000000
--- a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {
-    let mut a = ~3;
-    let mut b = &mut a;
-    let _c = &mut *b;
-    let mut d = /*move*/ a; //~ ERROR cannot move out
-    *d += 1;
-}
diff --git a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs
deleted file mode 100644
index e18808dfe53..00000000000
--- a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {
-    let mut b = ~3;
-    let _x = &mut *b;
-    let mut y = /*move*/ b; //~ ERROR cannot move out
-    *y += 1;
-}
diff --git a/src/test/compile-fail/borrowck-wg-move-base-2.rs b/src/test/compile-fail/borrowck-wg-move-base-2.rs
deleted file mode 100644
index 4050b4c5971..00000000000
--- a/src/test/compile-fail/borrowck-wg-move-base-2.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-fn foo(x: &mut int) {
-    let mut a = 3;
-    let mut _y = &mut *x;
-    let _z = &mut *_y;
-    _y = &mut a; //~ ERROR cannot assign
-}
-
-fn main() {
-}
diff --git a/src/test/run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs b/src/test/run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs
deleted file mode 100644
index c9bc061995d..00000000000
--- a/src/test/run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// error-pattern:borrowed
-
-// Issue #6272. Tests that freezing correctly accounts for all the
-// implicit derefs that can occur and freezes the innermost box. See
-// the companion test
-//
-//     run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs
-//
-// for a detailed explanation of what is going on here.
-
-#[feature(managed_boxes)];
-
-fn main() {
-    let a = @mut [3i];
-    let b = @mut [a];
-    let c = @mut b;
-
-    // this should freeze `a` only
-    let _x: &mut [int] = c[0];
-
-    // hence this should fail
-    a[0] = a[0];
-}
diff --git a/src/test/run-fail/borrowck-wg-fail-2.rs b/src/test/run-fail/borrowck-wg-fail-2.rs
deleted file mode 100644
index 284882ff6f5..00000000000
--- a/src/test/run-fail/borrowck-wg-fail-2.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// error-pattern:borrowed
-
-// Test that write guards trigger when there is a write to a field
-// of a frozen structure.
-
-#[feature(managed_boxes)];
-
-struct S {
-    x: int
-}
-
-fn main() {
-    let x = @mut S { x: 3 };
-    let _y: &S = x;
-    let z = x;
-    z.x = 5;
-}
diff --git a/src/test/run-fail/borrowck-wg-fail-3.rs b/src/test/run-fail/borrowck-wg-fail-3.rs
deleted file mode 100644
index 2643ed261f9..00000000000
--- a/src/test/run-fail/borrowck-wg-fail-3.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// error-pattern:borrowed
-
-// Test that write guards trigger when there is a write to a directly
-// frozen @mut box.
-
-#[feature(managed_boxes)];
-
-fn main() {
-    let x = @mut 3;
-    let _y: &mut int = x;
-    let z = x;
-    *z = 5;
-}
diff --git a/src/test/run-fail/borrowck-wg-fail-object-arg.rs b/src/test/run-fail/borrowck-wg-fail-object-arg.rs
deleted file mode 100644
index 4a5664d08b6..00000000000
--- a/src/test/run-fail/borrowck-wg-fail-object-arg.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#[feature(managed_boxes)];
-
-// error-pattern:borrowed
-
-trait Foo {
-    fn foo(&self, @mut int);
-}
-
-impl Foo for int {
-    fn foo(&self, x: @mut int) {
-        *x += *self;
-    }
-}
-
-fn it_takes_two(_f: &Foo, _g: &mut Foo) {
-}
-
-fn main() {
-    let x = @mut 3_i;
-    let y = x as @mut Foo;
-    let z = y;
-
-    it_takes_two(y, z);
-}
diff --git a/src/test/run-fail/borrowck-wg-fail-object.rs b/src/test/run-fail/borrowck-wg-fail-object.rs
deleted file mode 100644
index 9e32dbf6420..00000000000
--- a/src/test/run-fail/borrowck-wg-fail-object.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#[feature(managed_boxes)];
-
-// error-pattern:borrowed
-
-trait Foo {
-    fn foo(&self, @mut int);
-}
-
-impl Foo for int {
-    fn foo(&self, x: @mut int) {
-        *x += *self;
-    }
-}
-
-fn main() {
-    let x = @mut 3_i;
-    let y = x as @mut Foo;
-
-    // The call to `y.foo(...)` should freeze `y` (and thus also `x`,
-    // since `x === y`). It is thus an error when `foo` tries to
-    // mutate `x`.
-    y.foo(x);
-}
diff --git a/src/test/run-fail/borrowck-wg-fail.rs b/src/test/run-fail/borrowck-wg-fail.rs
deleted file mode 100644
index e1273381e93..00000000000
--- a/src/test/run-fail/borrowck-wg-fail.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-#[feature(managed_boxes)];
-
-// error-pattern:borrowed
-
-// Test that write guards trigger when mut box is frozen
-// as part of argument coercion.
-
-fn f(_x: &int, y: @mut int) {
-    *y = 2;
-}
-
-fn main() {
-    let x = @mut 3;
-    f(x, x);
-}
diff --git a/src/test/run-fail/borrowck-wg-imm-then-mut.rs b/src/test/run-fail/borrowck-wg-imm-then-mut.rs
deleted file mode 100644
index c41b9b37bb5..00000000000
--- a/src/test/run-fail/borrowck-wg-imm-then-mut.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#[feature(managed_boxes)];
-
-// error-pattern:borrowed
-
-// Test that if you imm borrow then mut borrow it fails.
-
-fn add1(a:@mut int)
-{
-    add2(a); // already frozen
-}
-
-fn add2(_:&mut int)
-{
-}
-
-pub fn main()
-{
-    let a = @mut 3;
-    let _b = &*a; // freezes a
-    add1(a);
-}
diff --git a/src/test/run-fail/borrowck-wg-mut-then-imm.rs b/src/test/run-fail/borrowck-wg-mut-then-imm.rs
deleted file mode 100644
index aceadb0459c..00000000000
--- a/src/test/run-fail/borrowck-wg-mut-then-imm.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#[feature(managed_boxes)];
-
-// error-pattern:borrowed
-
-// Test that if you mut borrow then imm borrow it fails.
-
-fn add1(a:@mut int)
-{
-    add2(a); // already frozen
-}
-
-fn add2(_:&int)
-{
-}
-
-pub fn main()
-{
-    let a = @mut 3;
-    let _b = &mut *a; // freezes a
-    add1(a);
-}
diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs
deleted file mode 100644
index d33e39e09a8..00000000000
--- a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// error-pattern:borrowed
-
-// Test that write guards trigger when there is a coercion to
-// a slice on the receiver of a method.
-
-#[feature(managed_boxes)];
-
-trait MyMutSlice {
-    fn my_mut_slice(self) -> Self;
-}
-
-impl<'a, T> MyMutSlice for &'a mut [T] {
-    fn my_mut_slice(self) -> &'a mut [T] {
-        self
-    }
-}
-
-trait MySlice {
-    fn my_slice(self) -> Self;
-}
-
-impl<'a, T> MySlice for &'a [T] {
-    fn my_slice(self) -> &'a [T] {
-        self
-    }
-}
-
-fn add(x:&mut [int], y:&[int])
-{
-    x[0] = x[0] + y[0];
-}
-
-pub fn main()
-{
-    let z = @mut [1,2,3];
-    let z2 = z;
-    add(z.my_mut_slice(), z2.my_slice());
-    println!("{}", z[0]);
-}
diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs
deleted file mode 100644
index 63287981bdc..00000000000
--- a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// error-pattern:borrowed
-
-// Test that write guards trigger when arguments are coerced to slices.
-
-#[feature(managed_boxes)];
-
-fn add(x:&mut [int], y:&[int])
-{
-    x[0] = x[0] + y[0];
-}
-
-pub fn main()
-{
-    let z = @mut [1,2,3];
-    let z2 = z;
-    add(z, z2);
-    println!("{}", z[0]);
-}
diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs
deleted file mode 100644
index 0820b94e181..00000000000
--- a/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// error-pattern:borrowed
-
-// Test that write guards trigger when we are indexing into
-// an @mut vector.
-
-#[feature(managed_boxes)];
-
-fn add(x:&mut int, y:&int)
-{
-    *x = *x + *y;
-}
-
-pub fn main()
-{
-    let z = @mut [1,2,3];
-    let z2 = z;
-    add(&mut z[0], &z2[0]);
-    println!("{}", z[0]);
-}
diff --git a/src/test/run-fail/borrowck-wg-two-array-indices.rs b/src/test/run-fail/borrowck-wg-two-array-indices.rs
deleted file mode 100644
index 5ee9cd37e87..00000000000
--- a/src/test/run-fail/borrowck-wg-two-array-indices.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// error-pattern:borrowed
-
-// Test that arguments trigger when there are *two mutable* borrows
-// of indices.
-
-#[feature(managed_boxes)];
-
-fn add(x:&mut int, y:&mut int)
-{
-    *x = *x + *y;
-}
-
-pub fn main()
-{
-    let z = @mut [1,2,3];
-    let z2 = z;
-    add(&mut z[0], &mut z2[0]);
-    println!("{}", z[0]);
-}
diff --git a/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs b/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs
deleted file mode 100644
index 27d337a28bf..00000000000
--- a/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Issue #6272. Tests that freezing correctly accounts for all the
-// implicit derefs that can occur.
-//
-// In this particular case, the expression:
-//
-//    let x: &mut [int] = c[0];
-//
-// is seen by borrowck as this sequence of derefs
-// and pointer offsets:
-//
-//    &*((**c)[0])
-//
-// or, written using `x.*` for `*x` (so that everything
-// is a postfix operation):
-//
-//    &c.*.*.[0].*
-//       ^    ^
-//       |    |
-//       b    a
-//
-// Here I also indicated where the evaluation yields the boxes `a` and
-// `b`. It is important then that we only freeze the innermost box
-// (`a`), and not the other ones (`b`, `c`).
-//
-// Also see the companion test:
-//
-// run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs
-
-#[feature(managed_boxes)];
-
-pub fn main() {
-    let a = @mut 3i;
-    let b = @mut [a];
-    let c = @mut [3];
-
-    // this should freeze `a` only
-    let _x: &mut int = a;
-
-    // hence these writes should not fail:
-    b[0] = b[0];
-    c[0] = c[0];
-}
diff --git a/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-2.rs b/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-2.rs
deleted file mode 100644
index d721704ba55..00000000000
--- a/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-2.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-struct Cat;
-
-fn bar(_: &Cat) {
-}
-
-fn foo(cat: &mut Cat) {
-    bar(&*cat);
-}
-
-pub fn main() {
-    let mut mimi = ~Cat;
-    foo(mimi);
-}
diff --git a/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs b/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs
deleted file mode 100644
index dcf497e81f7..00000000000
--- a/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-struct Wizard {
-    spells: ~[&'static str]
-}
-
-impl Wizard {
-    pub fn cast(&mut self) {
-        for &spell in self.spells.iter() {
-            println(spell);
-        }
-    }
-}
-
-pub fn main() {
-    let mut harry = Wizard {
-        spells: ~[ "expelliarmus", "expecto patronum", "incendio" ]
-    };
-    harry.cast();
-}
diff --git a/src/test/run-pass/borrowck-wg-borrow-mut-to-imm.rs b/src/test/run-pass/borrowck-wg-borrow-mut-to-imm.rs
deleted file mode 100644
index 668f602b3d3..00000000000
--- a/src/test/run-pass/borrowck-wg-borrow-mut-to-imm.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-fn g(x: &Option<int>) {
-    println(x.unwrap().to_str());
-}
-
-fn f(x: &mut Option<int>) {
-    g(&*x);
-}
-
-pub fn main() {
-    let mut x = ~Some(3);
-    f(x);
-}
diff --git a/src/test/run-pass/borrowck-wg-simple.rs b/src/test/run-pass/borrowck-wg-simple.rs
deleted file mode 100644
index f561dba2423..00000000000
--- a/src/test/run-pass/borrowck-wg-simple.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#[feature(managed_boxes)];
-
-fn f(x: &int) {
-    println(x.to_str());
-}
-
-pub fn main() {
-    let x = @mut 3;
-    f(x);
-}
diff --git a/src/test/run-pass/borrowck-wg-two-imm-borrows.rs b/src/test/run-pass/borrowck-wg-two-imm-borrows.rs
deleted file mode 100644
index efd0572c8c6..00000000000
--- a/src/test/run-pass/borrowck-wg-two-imm-borrows.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Test that we can borrow the same @mut box twice, so long as both are imm.
-
-#[feature(managed_boxes)];
-
-fn add(x:&int, y:&int)
-{
-    *x + *y;
-}
-
-pub fn main()
-{
-    let z = @mut [1,2,3];
-    let z2 = z;
-    add(&z[0], &z2[0]);
-    println!("{}", z[0]);
-}