]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-83760.stderr
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / issue-83760.stderr
1 error[E0382]: use of moved value
2   --> $DIR/issue-83760.rs:5:20
3    |
4 LL |     while let Some(foo) = val {
5    |                    ^^^ value moved here, in previous iteration of loop
6 LL |         if true {
7 LL |             val = None;
8    |             ---------- this reinitialization might get skipped
9    |
10    = note: move occurs because value has type `Struct`, which does not implement the `Copy` trait
11 help: borrow this binding in the pattern to avoid moving the value
12    |
13 LL |     while let Some(ref foo) = val {
14    |                    +++
15
16 error[E0382]: use of moved value: `foo`
17   --> $DIR/issue-83760.rs:21:14
18    |
19 LL |     let mut foo = Some(Struct);
20    |         ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
21 LL |     let _x = foo.unwrap();
22    |                  -------- `foo` moved due to this method call
23 LL |     if true {
24 LL |         foo = Some(Struct);
25    |         ------------------ this reinitialization might get skipped
26 ...
27 LL |     let _y = foo;
28    |              ^^^ value used here after move
29    |
30 note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
31   --> $SRC_DIR/core/src/option.rs:LL:COL
32
33 error[E0382]: use of moved value: `foo`
34   --> $DIR/issue-83760.rs:37:14
35    |
36 LL |     let mut foo = Some(Struct);
37    |         ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
38 LL |     let _x = foo.unwrap();
39    |                  -------- `foo` moved due to this method call
40 ...
41 LL |     let _y = foo;
42    |              ^^^ value used here after move
43    |
44 note: these 3 reinitializations and 1 other might get skipped
45   --> $DIR/issue-83760.rs:30:9
46    |
47 LL |         foo = Some(Struct);
48    |         ^^^^^^^^^^^^^^^^^^
49 LL |     } else if true {
50 LL |         foo = Some(Struct);
51    |         ^^^^^^^^^^^^^^^^^^
52 LL |     } else if true {
53 LL |         foo = Some(Struct);
54    |         ^^^^^^^^^^^^^^^^^^
55 note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
56   --> $SRC_DIR/core/src/option.rs:LL:COL
57
58 error: aborting due to 3 previous errors
59
60 For more information about this error, try `rustc --explain E0382`.