fork/rust

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

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

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