fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.4 KiB35 linesraw
1error[E0382]: use of moved value: `a`
2  --> $DIR/issue-31287-drop-in-guard.rs:7:9
3   |
4LL |     let a = Some("...".to_owned());
5   |         - move occurs because `a` has type `Option<String>`, which does not implement the `Copy` trait
6LL |     let b = match a {
7LL |         Some(_) if { drop(a); false } => None,
8   |                           - value moved here
9LL |         x => x,
10   |         ^ value used here after move
11   |
12help: consider cloning the value if the performance cost is acceptable
13   |
14LL |         Some(_) if { drop(a.clone()); false } => None,
15   |                            ++++++++
16
17error[E0382]: use of moved value: `a`
18  --> $DIR/issue-31287-drop-in-guard.rs:13:9
19   |
20LL |     let a = Some("...".to_owned());
21   |         - move occurs because `a` has type `Option<String>`, which does not implement the `Copy` trait
22LL |     let b = match a {
23LL |         Some(_) if let Some(()) = { drop(a); None } => None,
24   |                                          - value moved here
25LL |         x => x,
26   |         ^ value used here after move
27   |
28help: consider cloning the value if the performance cost is acceptable
29   |
30LL |         Some(_) if let Some(()) = { drop(a.clone()); None } => None,
31   |                                           ++++++++
32
33error: aborting due to 2 previous errors
34
35For more information about this error, try `rustc --explain E0382`.