summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-83760.stderr
blob: a585bff0c654395b8c208ca5c29ca9f5f7a70d2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
error[E0382]: use of moved value
  --> $DIR/issue-83760.rs:5:20
   |
LL |     while let Some(foo) = val {
   |                    ^^^ value moved here, in previous iteration of loop
LL |         if true {
LL |             val = None;
   |             ---------- this reinitialization might get skipped
   |
   = note: move occurs because value has type `Struct`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
   |
LL |     while let Some(ref foo) = val {
   |                    +++

error[E0382]: use of moved value: `foo`
  --> $DIR/issue-83760.rs:21:14
   |
LL |     let mut foo = Some(Struct);
   |         ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
LL |     let _x = foo.unwrap();
   |                  -------- `foo` moved due to this method call
LL |     if true {
LL |         foo = Some(Struct);
   |         ------------------ this reinitialization might get skipped
...
LL |     let _y = foo;
   |              ^^^ value used here after move
   |
note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
  --> $SRC_DIR/core/src/option.rs:LL:COL

error[E0382]: use of moved value: `foo`
  --> $DIR/issue-83760.rs:37:14
   |
LL |     let mut foo = Some(Struct);
   |         ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
LL |     let _x = foo.unwrap();
   |                  -------- `foo` moved due to this method call
...
LL |     let _y = foo;
   |              ^^^ value used here after move
   |
note: these 3 reinitializations and 1 other might get skipped
  --> $DIR/issue-83760.rs:30:9
   |
LL |         foo = Some(Struct);
   |         ^^^^^^^^^^^^^^^^^^
LL |     } else if true {
LL |         foo = Some(Struct);
   |         ^^^^^^^^^^^^^^^^^^
LL |     } else if true {
LL |         foo = Some(Struct);
   |         ^^^^^^^^^^^^^^^^^^
note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo`
  --> $SRC_DIR/core/src/option.rs:LL:COL

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0382`.