-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix diagnostics for
@ ..
binding pattern in tuples and tuple structs
fix comment add newline for tidy fmt error... edit suggestion message change the suggestion message to better handle cases with binding modes Apply suggestions from estebank code review Co-authored-by: Esteban Kuber <[email protected]> edits to address source review Apply suggestions from estebank code review #2 Co-authored-by: Esteban Kuber <[email protected]> update test files
- Loading branch information
1 parent
2873165
commit 27ed143
Showing
5 changed files
with
76 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fn main() { | ||
let x = (1, 2, 3); | ||
match x { | ||
(_a, _x @ ..) => {} | ||
_ => {} | ||
} | ||
} | ||
//~^^^^ ERROR `_x @` is not allowed in a tuple |
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,14 @@ | ||
error: `_x @` is not allowed in a tuple | ||
--> $DIR/issue-72574-1.rs:4:14 | ||
| | ||
LL | (_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 | (_a, ..) => {} | ||
| ^^ | ||
|
||
error: aborting due to previous error | ||
|
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,10 @@ | ||
struct Binder(i32, i32, i32); | ||
|
||
fn main() { | ||
let x = Binder(1, 2, 3); | ||
match x { | ||
Binder(_a, _x @ ..) => {} | ||
_ => {} | ||
} | ||
} | ||
//~^^^^ ERROR `_x @` is not allowed in a tuple struct |
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,14 @@ | ||
error: `_x @` is not allowed in a tuple struct | ||
--> $DIR/issue-72574-2.rs:6:20 | ||
| | ||
LL | Binder(_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 | Binder(_a, ..) => {} | ||
| ^^ | ||
|
||
error: aborting due to previous error | ||
|