about summary refs log tree commit diff
path: root/tests/ui/pattern
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/pattern
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/pattern')
-rw-r--r--tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
index 9359244c6eb..00964cb8336 100644
--- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
+++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
@@ -333,6 +333,11 @@ LL |         ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false
    |                                                                  ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
    |
    = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
+note: if `U` implemented `Clone`, you could clone the value
+  --> $DIR/borrowck-pat-ref-mut-and-ref.rs:17:5
+   |
+LL |     struct U;
+   |     ^^^^^^^^
 
 error[E0507]: cannot move out of `b` in pattern guard
   --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:66
@@ -341,6 +346,11 @@ LL |         ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false
    |                                                                  ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
    |
    = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
+note: if `U` implemented `Clone`, you could clone the value
+  --> $DIR/borrowck-pat-ref-mut-and-ref.rs:17:5
+   |
+LL |     struct U;
+   |     ^^^^^^^^
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0507]: cannot move out of `a` in pattern guard