|
1 |
| -error[E0381]: used binding `x` isn't initialized |
2 |
| - --> $DIR/match-cfg-fake-edges.rs:29:13 |
| 1 | +error[E0382]: use of moved value: `x` |
| 2 | + --> $DIR/match-cfg-fake-edges.rs:16:10 |
| 3 | + | |
| 4 | +LL | let x = String::new(); |
| 5 | + | - move occurs because `x` has type `String`, which does not implement the `Copy` trait |
| 6 | +... |
| 7 | +LL | _ => drop(x), |
| 8 | + | - value moved here |
| 9 | +... |
| 10 | +LL | drop(x); |
| 11 | + | ^ value used here after move |
| 12 | + | |
| 13 | +help: consider cloning the value if the performance cost is acceptable |
| 14 | + | |
| 15 | +LL | _ => drop(x.clone()), |
| 16 | + | ++++++++ |
| 17 | + |
| 18 | +error[E0382]: borrow of moved value: `x.0` |
| 19 | + --> $DIR/match-cfg-fake-edges.rs:22:5 |
| 20 | + | |
| 21 | +LL | (y, _) | (_, y) => (), |
| 22 | + | - value moved here |
| 23 | +LL | } |
| 24 | +LL | &x.0; |
| 25 | + | ^^^^ value borrowed here after move |
| 26 | + | |
| 27 | + = note: move occurs because `x.0` has type `String`, which does not implement the `Copy` trait |
| 28 | +help: borrow this binding in the pattern to avoid moving the value |
| 29 | + | |
| 30 | +LL | (ref y, _) | (_, y) => (), |
| 31 | + | +++ |
| 32 | + |
| 33 | +error[E0382]: borrow of moved value: `x.1` |
| 34 | + --> $DIR/match-cfg-fake-edges.rs:24:5 |
| 35 | + | |
| 36 | +LL | (y, _) | (_, y) => (), |
| 37 | + | - value moved here |
| 38 | +... |
| 39 | +LL | &x.1; |
| 40 | + | ^^^^ value borrowed here after move |
| 41 | + | |
| 42 | + = note: move occurs because `x.1` has type `String`, which does not implement the `Copy` trait |
| 43 | +help: borrow this binding in the pattern to avoid moving the value |
| 44 | + | |
| 45 | +LL | (y, _) | (_, ref y) => (), |
| 46 | + | +++ |
| 47 | + |
| 48 | +error[E0381]: used binding `x` is possibly-uninitialized |
| 49 | + --> $DIR/match-cfg-fake-edges.rs:58:19 |
3 | 50 | |
|
4 | 51 | LL | let x;
|
5 | 52 | | - binding declared here but left uninitialized
|
6 | 53 | ...
|
| 54 | +LL | _ => drop(x), |
| 55 | + | - ^ `x` used here but it is possibly-uninitialized |
| 56 | + | | |
| 57 | + | if this pattern is matched, `x` is not initialized |
| 58 | + |
| 59 | +error[E0381]: used binding `x` isn't initialized |
| 60 | + --> $DIR/match-cfg-fake-edges.rs:65:16 |
| 61 | + | |
| 62 | +LL | let x; |
| 63 | + | - binding declared here but left uninitialized |
| 64 | +LL | match y { |
7 | 65 | LL | _ if { x = 2; true } => 1,
|
8 | 66 | | ----- binding initialized here in some conditions
|
9 |
| -LL | _ if { |
10 |
| -LL | x; |
11 |
| - | ^ `x` used here but it isn't initialized |
| 67 | +LL | // Borrowck must not know the guard is always run. |
| 68 | +LL | _ if { x; false } => 2, |
| 69 | + | ^ `x` used here but it isn't initialized |
12 | 70 | |
|
13 | 71 | help: consider assigning a value
|
14 | 72 | |
|
15 | 73 | LL | let x = 0;
|
16 | 74 | | +++
|
17 | 75 |
|
18 | 76 | error[E0381]: used binding `x` isn't initialized
|
19 |
| - --> $DIR/match-cfg-fake-edges.rs:39:13 |
| 77 | + --> $DIR/match-cfg-fake-edges.rs:72:31 |
20 | 78 | |
|
21 | 79 | LL | let x;
|
22 | 80 | | - binding declared here but left uninitialized
|
23 | 81 | LL | match y {
|
24 | 82 | LL | _ if let Some(()) = { x = 2; Some(()) } => 1,
|
25 | 83 | | ----- binding initialized here in some conditions
|
26 |
| -LL | _ if let Some(()) = { |
27 |
| -LL | x; |
28 |
| - | ^ `x` used here but it isn't initialized |
| 84 | +LL | _ if let Some(()) = { x; None } => 2, |
| 85 | + | ^ `x` used here but it isn't initialized |
29 | 86 | |
|
30 | 87 | help: consider assigning a value
|
31 | 88 | |
|
32 | 89 | LL | let x = 0;
|
33 | 90 | | +++
|
34 | 91 |
|
35 | 92 | error[E0382]: use of moved value: `x`
|
36 |
| - --> $DIR/match-cfg-fake-edges.rs:53:13 |
| 93 | + --> $DIR/match-cfg-fake-edges.rs:85:22 |
37 | 94 | |
|
38 | 95 | LL | let x = String::new();
|
39 | 96 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait
|
40 |
| -... |
41 |
| -LL | false if { drop(x); true } => 1, |
| 97 | +LL | match y { |
| 98 | +LL | false if { drop(x); true } => {}, |
42 | 99 | | - value moved here
|
43 |
| -LL | true => { |
44 |
| -LL | x; |
45 |
| - | ^ value used here after move |
| 100 | +LL | // Borrowck must not know the guard is not run in the `true` case. |
| 101 | +LL | true => drop(x), |
| 102 | + | ^ value used here after move |
46 | 103 | |
|
47 | 104 | help: consider cloning the value if the performance cost is acceptable
|
48 | 105 | |
|
49 |
| -LL | false if { drop(x.clone()); true } => 1, |
| 106 | +LL | false if { drop(x.clone()); true } => {}, |
50 | 107 | | ++++++++
|
51 | 108 |
|
52 | 109 | error[E0382]: use of moved value: `x`
|
53 |
| - --> $DIR/match-cfg-fake-edges.rs:63:13 |
| 110 | + --> $DIR/match-cfg-fake-edges.rs:100:22 |
54 | 111 | |
|
55 | 112 | LL | let x = String::new();
|
56 | 113 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait
|
57 | 114 | LL | match y {
|
58 |
| -LL | false if let Some(()) = { drop(x); Some(()) } => 1, |
| 115 | +LL | false if let Some(()) = { drop(x); Some(()) } => {}, |
59 | 116 | | - value moved here
|
60 |
| -LL | true => { |
61 |
| -LL | x; |
62 |
| - | ^ value used here after move |
| 117 | +LL | true => drop(x), |
| 118 | + | ^ value used here after move |
63 | 119 | |
|
64 | 120 | help: consider cloning the value if the performance cost is acceptable
|
65 | 121 | |
|
66 |
| -LL | false if let Some(()) = { drop(x.clone()); Some(()) } => 1, |
| 122 | +LL | false if let Some(()) = { drop(x.clone()); Some(()) } => {}, |
67 | 123 | | ++++++++
|
68 | 124 |
|
69 |
| -error: aborting due to 4 previous errors |
| 125 | +error: aborting due to 8 previous errors |
70 | 126 |
|
71 | 127 | Some errors have detailed explanations: E0381, E0382.
|
72 | 128 | For more information about an error, try `rustc --explain E0381`.
|
0 commit comments