forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
154 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,128 @@ | ||
error[E0381]: used binding `x` isn't initialized | ||
--> $DIR/match-cfg-fake-edges.rs:29:13 | ||
error[E0382]: use of moved value: `x` | ||
--> $DIR/match-cfg-fake-edges.rs:16:10 | ||
| | ||
LL | let x = String::new(); | ||
| - move occurs because `x` has type `String`, which does not implement the `Copy` trait | ||
... | ||
LL | _ => drop(x), | ||
| - value moved here | ||
... | ||
LL | drop(x); | ||
| ^ value used here after move | ||
| | ||
help: consider cloning the value if the performance cost is acceptable | ||
| | ||
LL | _ => drop(x.clone()), | ||
| ++++++++ | ||
|
||
error[E0382]: borrow of moved value: `x.0` | ||
--> $DIR/match-cfg-fake-edges.rs:22:5 | ||
| | ||
LL | (y, _) | (_, y) => (), | ||
| - value moved here | ||
LL | } | ||
LL | &x.0; | ||
| ^^^^ value borrowed here after move | ||
| | ||
= note: move occurs because `x.0` has type `String`, which does not implement the `Copy` trait | ||
help: borrow this binding in the pattern to avoid moving the value | ||
| | ||
LL | (ref y, _) | (_, y) => (), | ||
| +++ | ||
|
||
error[E0382]: borrow of moved value: `x.1` | ||
--> $DIR/match-cfg-fake-edges.rs:24:5 | ||
| | ||
LL | (y, _) | (_, y) => (), | ||
| - value moved here | ||
... | ||
LL | &x.1; | ||
| ^^^^ value borrowed here after move | ||
| | ||
= note: move occurs because `x.1` has type `String`, which does not implement the `Copy` trait | ||
help: borrow this binding in the pattern to avoid moving the value | ||
| | ||
LL | (y, _) | (_, ref y) => (), | ||
| +++ | ||
|
||
error[E0381]: used binding `x` is possibly-uninitialized | ||
--> $DIR/match-cfg-fake-edges.rs:58:19 | ||
| | ||
LL | let x; | ||
| - binding declared here but left uninitialized | ||
... | ||
LL | _ => drop(x), | ||
| - ^ `x` used here but it is possibly-uninitialized | ||
| | | ||
| if this pattern is matched, `x` is not initialized | ||
|
||
error[E0381]: used binding `x` isn't initialized | ||
--> $DIR/match-cfg-fake-edges.rs:65:16 | ||
| | ||
LL | let x; | ||
| - binding declared here but left uninitialized | ||
LL | match y { | ||
LL | _ if { x = 2; true } => 1, | ||
| ----- binding initialized here in some conditions | ||
LL | _ if { | ||
LL | x; | ||
| ^ `x` used here but it isn't initialized | ||
LL | // Borrowck must not know the guard is always run. | ||
LL | _ if { x; false } => 2, | ||
| ^ `x` used here but it isn't initialized | ||
| | ||
help: consider assigning a value | ||
| | ||
LL | let x = 0; | ||
| +++ | ||
|
||
error[E0381]: used binding `x` isn't initialized | ||
--> $DIR/match-cfg-fake-edges.rs:39:13 | ||
--> $DIR/match-cfg-fake-edges.rs:72:31 | ||
| | ||
LL | let x; | ||
| - binding declared here but left uninitialized | ||
LL | match y { | ||
LL | _ if let Some(()) = { x = 2; Some(()) } => 1, | ||
| ----- binding initialized here in some conditions | ||
LL | _ if let Some(()) = { | ||
LL | x; | ||
| ^ `x` used here but it isn't initialized | ||
LL | _ if let Some(()) = { x; None } => 2, | ||
| ^ `x` used here but it isn't initialized | ||
| | ||
help: consider assigning a value | ||
| | ||
LL | let x = 0; | ||
| +++ | ||
|
||
error[E0382]: use of moved value: `x` | ||
--> $DIR/match-cfg-fake-edges.rs:53:13 | ||
--> $DIR/match-cfg-fake-edges.rs:85:22 | ||
| | ||
LL | let x = String::new(); | ||
| - move occurs because `x` has type `String`, which does not implement the `Copy` trait | ||
... | ||
LL | false if { drop(x); true } => 1, | ||
LL | match y { | ||
LL | false if { drop(x); true } => {}, | ||
| - value moved here | ||
LL | true => { | ||
LL | x; | ||
| ^ value used here after move | ||
LL | // Borrowck must not know the guard is not run in the `true` case. | ||
LL | true => drop(x), | ||
| ^ value used here after move | ||
| | ||
help: consider cloning the value if the performance cost is acceptable | ||
| | ||
LL | false if { drop(x.clone()); true } => 1, | ||
LL | false if { drop(x.clone()); true } => {}, | ||
| ++++++++ | ||
|
||
error[E0382]: use of moved value: `x` | ||
--> $DIR/match-cfg-fake-edges.rs:63:13 | ||
--> $DIR/match-cfg-fake-edges.rs:100:22 | ||
| | ||
LL | let x = String::new(); | ||
| - move occurs because `x` has type `String`, which does not implement the `Copy` trait | ||
LL | match y { | ||
LL | false if let Some(()) = { drop(x); Some(()) } => 1, | ||
LL | false if let Some(()) = { drop(x); Some(()) } => {}, | ||
| - value moved here | ||
LL | true => { | ||
LL | x; | ||
| ^ value used here after move | ||
LL | true => drop(x), | ||
| ^ value used here after move | ||
| | ||
help: consider cloning the value if the performance cost is acceptable | ||
| | ||
LL | false if let Some(()) = { drop(x.clone()); Some(()) } => 1, | ||
LL | false if let Some(()) = { drop(x.clone()); Some(()) } => {}, | ||
| ++++++++ | ||
|
||
error: aborting due to 4 previous errors | ||
error: aborting due to 8 previous errors | ||
|
||
Some errors have detailed explanations: E0381, E0382. | ||
For more information about an error, try `rustc --explain E0381`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters