fix(parse): return unpected when current token is EOF
This commit is contained in:
parent
077fc26f0a
commit
272dc5a6d5
@ -536,7 +536,9 @@ impl<'a> Parser<'a> {
|
||||
} else if inedible.contains(&self.token.kind) {
|
||||
// leave it in the input
|
||||
Ok(false)
|
||||
} else if self.last_unexpected_token_span == Some(self.token.span) {
|
||||
} else if self.token.kind != token::Eof
|
||||
&& self.last_unexpected_token_span == Some(self.token.span)
|
||||
{
|
||||
FatalError.raise();
|
||||
} else {
|
||||
self.expected_one_of_not_found(edible, inedible)
|
||||
|
2
tests/ui/parser/issues/issue-111148.rs
Normal file
2
tests/ui/parser/issues/issue-111148.rs
Normal file
@ -0,0 +1,2 @@
|
||||
fn a<<i<Y<w<>#
|
||||
//~^ ERROR expected one of `#`, `>`, `const`, identifier, or lifetime, found `<`
|
8
tests/ui/parser/issues/issue-111148.stderr
Normal file
8
tests/ui/parser/issues/issue-111148.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `<`
|
||||
--> $DIR/issue-111148.rs:1:6
|
||||
|
|
||||
LL | fn a<<i<Y<w<>#
|
||||
| ^ expected one of `#`, `>`, `const`, identifier, or lifetime
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
x
Reference in New Issue
Block a user