about summary refs log tree commit diff
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-03-17 21:25:38 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-04-11 16:41:42 +0000
commitd97d2fe7440ea3032a93fa3ebf8d62fea0337d04 (patch)
tree84f778762a45c6c7820a0dcdd557292424e9d926 /tests/ui/error-codes
parentd578ac9e476a376246320db1d934972601c5b0f5 (diff)
downloadrust-d97d2fe7440ea3032a93fa3ebf8d62fea0337d04.tar.gz
rust-d97d2fe7440ea3032a93fa3ebf8d62fea0337d04.zip
Mention when the type of the moved value doesn't implement `Clone`
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0504.stderr6
-rw-r--r--tests/ui/error-codes/E0505.stderr6
-rw-r--r--tests/ui/error-codes/E0507.stderr5
-rw-r--r--tests/ui/error-codes/E0508-fail.stderr5
-rw-r--r--tests/ui/error-codes/E0508.stderr5
-rw-r--r--tests/ui/error-codes/E0509.stderr5
6 files changed, 32 insertions, 0 deletions
diff --git a/tests/ui/error-codes/E0504.stderr b/tests/ui/error-codes/E0504.stderr
index c8a48961cb3..900cb706bd9 100644
--- a/tests/ui/error-codes/E0504.stderr
+++ b/tests/ui/error-codes/E0504.stderr
@@ -13,6 +13,12 @@ LL |         println!("child function: {}", fancy_num.num);
 ...
 LL |     println!("main function: {}", fancy_ref.num);
    |                                   ------------- borrow later used here
+   |
+note: if `FancyNum` implemented `Clone`, you could clone the value
+  --> $DIR/E0504.rs:1:1
+   |
+LL | struct FancyNum {
+   | ^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0505.stderr b/tests/ui/error-codes/E0505.stderr
index 250680d2c1c..ce01298a70d 100644
--- a/tests/ui/error-codes/E0505.stderr
+++ b/tests/ui/error-codes/E0505.stderr
@@ -10,6 +10,12 @@ LL |         eat(x);
    |             ^ move out of `x` occurs here
 LL |         _ref_to_val.use_ref();
    |         ----------- borrow later used here
+   |
+note: if `Value` implemented `Clone`, you could clone the value
+  --> $DIR/E0505.rs:1:1
+   |
+LL | struct Value {}
+   | ^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0507.stderr b/tests/ui/error-codes/E0507.stderr
index 767fedfccbf..60a4daa9d38 100644
--- a/tests/ui/error-codes/E0507.stderr
+++ b/tests/ui/error-codes/E0507.stderr
@@ -11,6 +11,11 @@ note: `TheDarkKnight::nothing_is_true` takes ownership of the receiver `self`, w
    |
 LL |     fn nothing_is_true(self) {}
    |                        ^^^^
+note: if `TheDarkKnight` implemented `Clone`, you could clone the value
+  --> $DIR/E0507.rs:3:1
+   |
+LL | struct TheDarkKnight;
+   | ^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0508-fail.stderr b/tests/ui/error-codes/E0508-fail.stderr
index 1153b1d09c7..96d3bcb67a5 100644
--- a/tests/ui/error-codes/E0508-fail.stderr
+++ b/tests/ui/error-codes/E0508-fail.stderr
@@ -7,6 +7,11 @@ LL |     let _value = array[0];
    |                  cannot move out of here
    |                  move occurs because `array[_]` has type `NonCopy`, which does not implement the `Copy` trait
    |
+note: if `NonCopy` implemented `Clone`, you could clone the value
+  --> $DIR/E0508-fail.rs:1:1
+   |
+LL | struct NonCopy;
+   | ^^^^^^^^^^^^^^
 help: consider borrowing here
    |
 LL |     let _value = &array[0];
diff --git a/tests/ui/error-codes/E0508.stderr b/tests/ui/error-codes/E0508.stderr
index 4c864e24144..c1b622e2432 100644
--- a/tests/ui/error-codes/E0508.stderr
+++ b/tests/ui/error-codes/E0508.stderr
@@ -7,6 +7,11 @@ LL |     let _value = array[0];
    |                  cannot move out of here
    |                  move occurs because `array[_]` has type `NonCopy`, which does not implement the `Copy` trait
    |
+note: if `NonCopy` implemented `Clone`, you could clone the value
+  --> $DIR/E0508.rs:1:1
+   |
+LL | struct NonCopy;
+   | ^^^^^^^^^^^^^^
 help: consider borrowing here
    |
 LL |     let _value = &array[0];
diff --git a/tests/ui/error-codes/E0509.stderr b/tests/ui/error-codes/E0509.stderr
index 59843a5491a..75c372d0440 100644
--- a/tests/ui/error-codes/E0509.stderr
+++ b/tests/ui/error-codes/E0509.stderr
@@ -7,6 +7,11 @@ LL |     let fancy_field = drop_struct.fancy;
    |                       cannot move out of here
    |                       move occurs because `drop_struct.fancy` has type `FancyNum`, which does not implement the `Copy` trait
    |
+note: if `FancyNum` implemented `Clone`, you could clone the value
+  --> $DIR/E0509.rs:1:1
+   |
+LL | struct FancyNum {
+   | ^^^^^^^^^^^^^^^
 help: consider borrowing here
    |
 LL |     let fancy_field = &drop_struct.fancy;