2020-08-08 12:16:43 -05:00
|
|
|
error[E0382]: use of partially moved value: `s`
|
2020-06-20 00:45:09 -05:00
|
|
|
--> $DIR/move-in-pattern.rs:19:9
|
|
|
|
|
|
|
|
|
LL | if let Some(x) = s {
|
2020-08-08 12:16:43 -05:00
|
|
|
| - value partially moved here
|
2020-06-20 00:45:09 -05:00
|
|
|
...
|
|
|
|
LL | foo(s);
|
|
|
|
| ^ value used here after partial move
|
|
|
|
|
|
2020-08-08 12:16:43 -05:00
|
|
|
= note: partial move occurs because value has type `S`, which does not implement the `Copy` trait
|
2022-11-02 23:22:24 -05:00
|
|
|
help: borrow this binding in the pattern to avoid moving the value
|
2020-06-20 00:45:09 -05:00
|
|
|
|
|
|
|
|
LL | if let Some(ref x) = s {
|
2021-06-21 21:07:19 -05:00
|
|
|
| +++
|
2020-06-20 00:45:09 -05:00
|
|
|
|
2020-08-08 12:16:43 -05:00
|
|
|
error[E0382]: use of partially moved value: `e`
|
2020-06-20 00:45:09 -05:00
|
|
|
--> $DIR/move-in-pattern.rs:23:9
|
|
|
|
|
|
|
|
|
LL | let E::V { s: x } = e;
|
2020-08-08 12:16:43 -05:00
|
|
|
| - value partially moved here
|
2020-06-20 00:45:09 -05:00
|
|
|
LL | let _ = x;
|
|
|
|
LL | bar(e);
|
|
|
|
| ^ value used here after partial move
|
|
|
|
|
|
2020-08-08 12:16:43 -05:00
|
|
|
= note: partial move occurs because value has type `S`, which does not implement the `Copy` trait
|
2022-11-02 23:22:24 -05:00
|
|
|
help: borrow this binding in the pattern to avoid moving the value
|
2020-06-20 00:45:09 -05:00
|
|
|
|
|
|
|
|
LL | let E::V { s: ref x } = e;
|
2021-06-21 21:07:19 -05:00
|
|
|
| +++
|
2020-06-20 00:45:09 -05:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|