Rollup merge of #84140 - b-naber:parser_past_eof, r=varkor
Don't call bump in check_mistyped_turbofish_with_multiple_type_params Fixes https://github.com/rust-lang/rust/issues/84117
This commit is contained in:
commit
e40d7e6d84
@ -666,21 +666,23 @@ impl<'a> Parser<'a> {
|
||||
);
|
||||
match x {
|
||||
Ok((_, _, false)) => {
|
||||
self.bump(); // `>`
|
||||
match self.parse_expr() {
|
||||
Ok(_) => {
|
||||
e.span_suggestion_verbose(
|
||||
binop.span.shrink_to_lo(),
|
||||
TURBOFISH_SUGGESTION_STR,
|
||||
"::".to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
e.emit();
|
||||
*expr = self.mk_expr_err(expr.span.to(self.prev_token.span));
|
||||
return Ok(());
|
||||
}
|
||||
Err(mut err) => {
|
||||
err.cancel();
|
||||
if self.eat(&token::Gt) {
|
||||
match self.parse_expr() {
|
||||
Ok(_) => {
|
||||
e.span_suggestion_verbose(
|
||||
binop.span.shrink_to_lo(),
|
||||
TURBOFISH_SUGGESTION_STR,
|
||||
"::".to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
e.emit();
|
||||
*expr =
|
||||
self.mk_expr_err(expr.span.to(self.prev_token.span));
|
||||
return Ok(());
|
||||
}
|
||||
Err(mut err) => {
|
||||
err.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
9
src/test/ui/parser/issue-84117.rs
Normal file
9
src/test/ui/parser/issue-84117.rs
Normal file
@ -0,0 +1,9 @@
|
||||
fn main() {
|
||||
let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
|
||||
//~^ ERROR expected one of `>`, a const expression
|
||||
//~| ERROR expected one of `>`, a const expression, lifetime, or type, found `}`
|
||||
//~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,`
|
||||
//~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,`
|
||||
//~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,`
|
||||
}
|
||||
//~^ ERROR expected one of `,`, `:`, `=`, or `>`, found `}`
|
49
src/test/ui/parser/issue-84117.stderr
Normal file
49
src/test/ui/parser/issue-84117.stderr
Normal file
@ -0,0 +1,49 @@
|
||||
error: expected one of `>`, a const expression, lifetime, or type, found `}`
|
||||
--> $DIR/issue-84117.rs:2:67
|
||||
|
|
||||
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
|
||||
| ------------ ^ expected one of `>`, a const expression, lifetime, or type
|
||||
| | |
|
||||
| | help: use `=` if you meant to assign
|
||||
| while parsing the type for `inner_local`
|
||||
|
||||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,`
|
||||
--> $DIR/issue-84117.rs:2:65
|
||||
|
|
||||
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
|
||||
| ^ expected one of 7 possible tokens
|
||||
|
||||
error: expected one of `,`, `:`, `=`, or `>`, found `}`
|
||||
--> $DIR/issue-84117.rs:8:1
|
||||
|
|
||||
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
|
||||
| ------------ help: use `=` if you meant to assign - expected one of `,`, `:`, `=`, or `>`
|
||||
| |
|
||||
| while parsing the type for `outer_local`
|
||||
...
|
||||
LL | }
|
||||
| ^ unexpected token
|
||||
|
||||
error: expected one of `>`, a const expression, lifetime, or type, found `}`
|
||||
--> $DIR/issue-84117.rs:2:67
|
||||
|
|
||||
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
|
||||
| ------------ ^ expected one of `>`, a const expression, lifetime, or type
|
||||
| | |
|
||||
| | help: use `=` if you meant to assign
|
||||
| while parsing the type for `inner_local`
|
||||
|
||||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,`
|
||||
--> $DIR/issue-84117.rs:2:65
|
||||
|
|
||||
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
|
||||
| ^ expected one of 7 possible tokens
|
||||
|
||||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,`
|
||||
--> $DIR/issue-84117.rs:2:33
|
||||
|
|
||||
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
|
||||
| ^ expected one of 7 possible tokens
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user