summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-83760.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/issue-83760.stderr')
-rw-r--r--tests/ui/borrowck/issue-83760.stderr42
1 files changed, 30 insertions, 12 deletions
diff --git a/tests/ui/borrowck/issue-83760.stderr b/tests/ui/borrowck/issue-83760.stderr
index a585bff0c..d120adbc0 100644
--- a/tests/ui/borrowck/issue-83760.stderr
+++ b/tests/ui/borrowck/issue-83760.stderr
@@ -1,5 +1,5 @@
error[E0382]: use of moved value
- --> $DIR/issue-83760.rs:5:20
+ --> $DIR/issue-83760.rs:10:20
|
LL | while let Some(foo) = val {
| ^^^ value moved here, in previous iteration of loop
@@ -14,7 +14,7 @@ LL | while let Some(ref foo) = val {
| +++
error[E0382]: use of moved value: `foo`
- --> $DIR/issue-83760.rs:21:14
+ --> $DIR/issue-83760.rs:26:14
|
LL | let mut foo = Some(Struct);
| ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
@@ -29,12 +29,21 @@ LL | let _y = foo;
|
note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
--> $SRC_DIR/core/src/option.rs:LL:COL
+help: you could `clone` the value and consume it, if the `Struct: Clone` trait bound could be satisfied
+ |
+LL | let _x = foo.clone().unwrap();
+ | ++++++++
+help: consider annotating `Struct` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct Struct;
+ |
error[E0382]: use of moved value: `foo`
- --> $DIR/issue-83760.rs:37:14
+ --> $DIR/issue-83760.rs:42:14
|
-LL | let mut foo = Some(Struct);
- | ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
+LL | let mut foo = Some(Struct2);
+ | ------- move occurs because `foo` has type `Option<Struct2>`, which does not implement the `Copy` trait
LL | let _x = foo.unwrap();
| -------- `foo` moved due to this method call
...
@@ -42,18 +51,27 @@ LL | let _y = foo;
| ^^^ value used here after move
|
note: these 3 reinitializations and 1 other might get skipped
- --> $DIR/issue-83760.rs:30:9
+ --> $DIR/issue-83760.rs:35:9
|
-LL | foo = Some(Struct);
- | ^^^^^^^^^^^^^^^^^^
+LL | foo = Some(Struct2);
+ | ^^^^^^^^^^^^^^^^^^^
LL | } else if true {
-LL | foo = Some(Struct);
- | ^^^^^^^^^^^^^^^^^^
+LL | foo = Some(Struct2);
+ | ^^^^^^^^^^^^^^^^^^^
LL | } else if true {
-LL | foo = Some(Struct);
- | ^^^^^^^^^^^^^^^^^^
+LL | foo = Some(Struct2);
+ | ^^^^^^^^^^^^^^^^^^^
note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
--> $SRC_DIR/core/src/option.rs:LL:COL
+help: you could `clone` the value and consume it, if the `Struct2: Clone` trait bound could be satisfied
+ |
+LL | let _x = foo.clone().unwrap();
+ | ++++++++
+help: consider annotating `Struct2` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct Struct2;
+ |
error: aborting due to 3 previous errors