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