about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/issues/issue-2823.rs14
-rw-r--r--tests/ui/issues/issue-2823.stderr16
-rw-r--r--tests/ui/methods/clone-missing.rs33
-rw-r--r--tests/ui/methods/clone-missing.stderr25
-rw-r--r--tests/ui/noncopyable-class.rs36
-rw-r--r--tests/ui/noncopyable-class.stderr16
6 files changed, 43 insertions, 97 deletions
diff --git a/tests/ui/issues/issue-2823.rs b/tests/ui/issues/issue-2823.rs
deleted file mode 100644
index 7b443b41526..00000000000
--- a/tests/ui/issues/issue-2823.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-struct C {
-    x: isize,
-}
-
-impl Drop for C {
-    fn drop(&mut self) {
-        println!("dropping: {}", self.x);
-    }
-}
-
-fn main() {
-    let c = C{ x: 2};
-    let _d = c.clone(); //~ ERROR no method named `clone` found
-}
diff --git a/tests/ui/issues/issue-2823.stderr b/tests/ui/issues/issue-2823.stderr
deleted file mode 100644
index 5cd3f080450..00000000000
--- a/tests/ui/issues/issue-2823.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0599]: no method named `clone` found for struct `C` in the current scope
-  --> $DIR/issue-2823.rs:13:16
-   |
-LL | struct C {
-   | -------- method `clone` not found for this struct
-...
-LL |     let _d = c.clone();
-   |                ^^^^^ method not found in `C`
-   |
-   = help: items from traits can only be used if the trait is implemented and in scope
-   = note: the following trait defines an item `clone`, perhaps you need to implement it:
-           candidate #1: `Clone`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/methods/clone-missing.rs b/tests/ui/methods/clone-missing.rs
index f2e4ad268c6..c5ecd3f175e 100644
--- a/tests/ui/methods/clone-missing.rs
+++ b/tests/ui/methods/clone-missing.rs
@@ -1,19 +1,34 @@
-// This test checks that calling `.clone()` on a type that does not implement the `Clone` trait
-// results in a compilation error. The `Foo` struct does not derive or implement `Clone`,
-// so attempting to clone it should fail.
+//! This test checks that calling `.clone()` on a type that does
+//! not implement the `Clone` trait results in a compilation error.
+//! The `NotClone` and AlsoNotClone structs do not derive or
+//! implement `Clone`, so attempting to clone them should fail.
 
-struct Foo {
-  i: isize,
+struct NotClone {
+    i: isize,
 }
 
-fn foo(i:isize) -> Foo {
-    Foo {
-        i: i
+fn not_clone(i: isize) -> NotClone {
+    NotClone { i }
+}
+
+struct AlsoNotClone {
+    i: isize,
+    j: NotClone,
+}
+
+fn also_not_clone(i: isize) -> AlsoNotClone {
+    AlsoNotClone {
+        i,
+        j: NotClone { i: i },
     }
 }
 
 fn main() {
-    let x = foo(10);
+    let x = not_clone(10);
+    let _y = x.clone();
+    //~^ ERROR no method named `clone` found
+
+    let x = also_not_clone(10);
     let _y = x.clone();
     //~^ ERROR no method named `clone` found
 }
diff --git a/tests/ui/methods/clone-missing.stderr b/tests/ui/methods/clone-missing.stderr
index 4ab1aae4934..8676e73c8ca 100644
--- a/tests/ui/methods/clone-missing.stderr
+++ b/tests/ui/methods/clone-missing.stderr
@@ -1,16 +1,29 @@
-error[E0599]: no method named `clone` found for struct `Foo` in the current scope
-  --> $DIR/clone-missing.rs:17:16
+error[E0599]: no method named `clone` found for struct `NotClone` in the current scope
+  --> $DIR/clone-missing.rs:28:16
    |
-LL | struct Foo {
-   | ---------- method `clone` not found for this struct
+LL | struct NotClone {
+   | --------------- method `clone` not found for this struct
 ...
 LL |     let _y = x.clone();
-   |                ^^^^^ method not found in `Foo`
+   |                ^^^^^ method not found in `NotClone`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `clone`, perhaps you need to implement it:
            candidate #1: `Clone`
 
-error: aborting due to 1 previous error
+error[E0599]: no method named `clone` found for struct `AlsoNotClone` in the current scope
+  --> $DIR/clone-missing.rs:32:16
+   |
+LL | struct AlsoNotClone {
+   | ------------------- method `clone` not found for this struct
+...
+LL |     let _y = x.clone();
+   |                ^^^^^ method not found in `AlsoNotClone`
+   |
+   = help: items from traits can only be used if the trait is implemented and in scope
+   = note: the following trait defines an item `clone`, perhaps you need to implement it:
+           candidate #1: `Clone`
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/noncopyable-class.rs b/tests/ui/noncopyable-class.rs
deleted file mode 100644
index 11b6eb736e9..00000000000
--- a/tests/ui/noncopyable-class.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Test that a class with a non-copyable field can't be
-// copied
-
-#[derive(Debug)]
-struct Bar {
-  x: isize,
-}
-
-impl Drop for Bar {
-    fn drop(&mut self) {}
-}
-
-fn bar(x:isize) -> Bar {
-    Bar {
-        x: x
-    }
-}
-
-#[derive(Debug)]
-struct Foo {
-  i: isize,
-  j: Bar,
-}
-
-fn foo(i:isize) -> Foo {
-    Foo {
-        i: i,
-        j: bar(5)
-    }
-}
-
-fn main() {
-    let x = foo(10);
-    let _y = x.clone(); //~ ERROR no method named `clone` found
-    println!("{:?}", x);
-}
diff --git a/tests/ui/noncopyable-class.stderr b/tests/ui/noncopyable-class.stderr
deleted file mode 100644
index b8f7276c898..00000000000
--- a/tests/ui/noncopyable-class.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0599]: no method named `clone` found for struct `Foo` in the current scope
-  --> $DIR/noncopyable-class.rs:34:16
-   |
-LL | struct Foo {
-   | ---------- method `clone` not found for this struct
-...
-LL |     let _y = x.clone();
-   |                ^^^^^ method not found in `Foo`
-   |
-   = help: items from traits can only be used if the trait is implemented and in scope
-   = note: the following trait defines an item `clone`, perhaps you need to implement it:
-           candidate #1: `Clone`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0599`.