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.
Fix an ICE on an invalid
binding @ ...
in a tuple struct pattern
- Loading branch information
1 parent
d3df851
commit f5e5eb6
Showing
3 changed files
with
40 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
enum E { | ||
A(u8, u8), | ||
} | ||
|
||
fn main() { | ||
let e = E::A(2, 3); | ||
match e { | ||
E::A(x @ ..) => { //~ ERROR `x @` is not allowed in a tuple | ||
x //~ ERROR cannot find value `x` in this scope | ||
} | ||
}; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0425]: cannot find value `x` in this scope | ||
--> $DIR/issue-74539.rs:9:13 | ||
| | ||
LL | x | ||
| ^ help: a local variable with a similar name exists: `e` | ||
|
||
error: `x @` is not allowed in a tuple struct | ||
--> $DIR/issue-74539.rs:8:14 | ||
| | ||
LL | E::A(x @ ..) => { | ||
| ^^^^^^ this is only allowed in slice patterns | ||
| | ||
= help: remove this and bind each tuple field independently | ||
help: if you don't need to use the contents of x, discard the tuple's remaining fields | ||
| | ||
LL | E::A(..) => { | ||
| ^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0425`. |