summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/issue-83760.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/borrowck/issue-83760.stderr
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/borrowck/issue-83760.stderr')
-rw-r--r--src/test/ui/borrowck/issue-83760.stderr62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/issue-83760.stderr b/src/test/ui/borrowck/issue-83760.stderr
new file mode 100644
index 000000000..beeda5685
--- /dev/null
+++ b/src/test/ui/borrowck/issue-83760.stderr
@@ -0,0 +1,62 @@
+error[E0382]: use of moved value
+ --> $DIR/issue-83760.rs:5:20
+ |
+LL | while let Some(foo) = val {
+ | ^^^ value moved here, in previous iteration of loop
+LL | if true {
+LL | val = None;
+ | ---------- this reinitialization might get skipped
+ |
+ = note: move occurs because value has type `Struct`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `foo`
+ --> $DIR/issue-83760.rs:21:14
+ |
+LL | let mut foo = Some(Struct);
+ | ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
+LL | let _x = foo.unwrap();
+ | -------- `foo` moved due to this method call
+LL | if true {
+LL | foo = Some(Struct);
+ | ------------------ this reinitialization might get skipped
+...
+LL | let _y = foo;
+ | ^^^ value used here after move
+ |
+note: this function takes ownership of the receiver `self`, which moves `foo`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ |
+LL | pub const fn unwrap(self) -> T {
+ | ^^^^
+
+error[E0382]: use of moved value: `foo`
+ --> $DIR/issue-83760.rs:37:14
+ |
+LL | let mut foo = Some(Struct);
+ | ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
+LL | let _x = foo.unwrap();
+ | -------- `foo` moved due to this method call
+...
+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
+ |
+LL | foo = Some(Struct);
+ | ^^^^^^^^^^^^^^^^^^
+LL | } else if true {
+LL | foo = Some(Struct);
+ | ^^^^^^^^^^^^^^^^^^
+LL | } else if true {
+LL | foo = Some(Struct);
+ | ^^^^^^^^^^^^^^^^^^
+note: this function takes ownership of the receiver `self`, which moves `foo`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ |
+LL | pub const fn unwrap(self) -> T {
+ | ^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0382`.