2019-05-05 11:02:32 +00:00
|
|
|
error[E0507]: cannot move out of `foo` in pattern guard
|
2022-12-21 15:29:35 +00:00
|
|
|
--> $DIR/issue-27282-move-ref-mut-into-guard.rs:11:19
|
2018-05-15 21:23:00 +00:00
|
|
|
|
|
|
|
|
LL | if { (|| { let bar = foo; bar.take() })(); false } => {},
|
2022-03-02 04:30:16 +00:00
|
|
|
| ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
|
|
|
|
| |
|
2023-01-15 03:06:44 +00:00
|
|
|
| `foo` is moved here
|
2019-05-05 11:02:32 +00:00
|
|
|
|
|
|
|
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
|
2018-05-15 21:23:00 +00:00
|
|
|
|
2022-12-21 15:29:35 +00:00
|
|
|
error[E0507]: cannot move out of `foo` in pattern guard
|
|
|
|
--> $DIR/issue-27282-move-ref-mut-into-guard.rs:19:34
|
|
|
|
|
|
|
|
|
LL | if let Some(()) = { (|| { let bar = foo; bar.take() })(); None } => {},
|
|
|
|
| ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
|
|
|
|
| |
|
2023-01-15 03:06:44 +00:00
|
|
|
| `foo` is moved here
|
2022-12-21 15:29:35 +00:00
|
|
|
|
|
|
|
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
|
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
2018-05-15 21:23:00 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0507`.
|