-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak invalid
fn
header and body parsing
* Recover empty `fn` bodies when encountering `}` * Recover trailing `>` in return types * Recover from non-type in array type `[<BAD TOKEN>; LEN]`
- Loading branch information
Showing
7 changed files
with
53 additions
and
27 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
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,4 +1,3 @@ | ||
fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0` | ||
//~| ERROR expected one of `)`, `,`, `->`, `;`, `where`, or `{`, found `]` | ||
|
||
fn main() {} |
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,8 +1,9 @@ | ||
// Verify that '>' is not both expected and found at the same time, as it used | ||
// to happen in #24780. For example, following should be an error: | ||
// expected one of ..., `>`, ... found `>` | ||
// expected one of ..., `>`, ... found `>`. No longer exactly this, but keeping for posterity. | ||
|
||
fn foo() -> Vec<usize>> { | ||
//~^ ERROR expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>` | ||
fn foo() -> Vec<usize>> { //~ ERROR unmatched angle bracket | ||
Vec::new() | ||
} | ||
|
||
fn main() {} |
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,8 +1,8 @@ | ||
error: expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>` | ||
error: unmatched angle bracket | ||
--> $DIR/issue-24780.rs:5:23 | ||
| | ||
LL | fn foo() -> Vec<usize>> { | ||
| ^ expected one of `!`, `+`, `::`, `;`, `where`, or `{` | ||
| ^^ help: remove extra angle bracket | ||
|
||
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