cancel a not emitted error after parsing const generic args
This commit is contained in:
parent
2d15732f6e
commit
62ded071d5
@ -630,10 +630,14 @@ impl<'a> Parser<'a> {
|
|||||||
Ok(ty) => GenericArg::Type(ty),
|
Ok(ty) => GenericArg::Type(ty),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
if is_const_fn {
|
if is_const_fn {
|
||||||
if let Ok(expr) = (*snapshot).parse_expr_res(Restrictions::CONST_EXPR, None)
|
match (*snapshot).parse_expr_res(Restrictions::CONST_EXPR, None) {
|
||||||
{
|
Ok(expr) => {
|
||||||
self.restore_snapshot(snapshot);
|
self.restore_snapshot(snapshot);
|
||||||
return Ok(Some(self.dummy_const_arg_needs_braces(err, expr.span)));
|
return Ok(Some(self.dummy_const_arg_needs_braces(err, expr.span)));
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
err.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Try to recover from possible `const` arg without braces.
|
// Try to recover from possible `const` arg without braces.
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
// #95163
|
||||||
|
fn return_ty() -> impl Into<<() as Reexported;
|
||||||
|
//~^ ERROR expected one of `(`, `::`, `<`, or `>`, found `;`
|
||||||
|
|
||||||
|
fn main() {}
|
@ -0,0 +1,8 @@
|
|||||||
|
error: expected one of `(`, `::`, `<`, or `>`, found `;`
|
||||||
|
--> $DIR/ice-const-generic-function-return-ty.rs:2:46
|
||||||
|
|
|
||||||
|
LL | fn return_ty() -> impl Into<<() as Reexported;
|
||||||
|
| ^ expected one of `(`, `::`, `<`, or `>`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user