Rollup merge of #95200 - TaKO8Ki:cancel-not-emitted-error-when-parsing-generic-arg, r=oli-obk
Cancel a not emitted error after parsing const generic args closes #95163
This commit is contained in:
commit
5d3dfb446f
3 changed files with 21 additions and 4 deletions
|
@ -630,10 +630,14 @@ impl<'a> Parser<'a> {
|
|||
Ok(ty) => GenericArg::Type(ty),
|
||||
Err(err) => {
|
||||
if is_const_fn {
|
||||
if let Ok(expr) = (*snapshot).parse_expr_res(Restrictions::CONST_EXPR, None)
|
||||
{
|
||||
self.restore_snapshot(snapshot);
|
||||
return Ok(Some(self.dummy_const_arg_needs_braces(err, expr.span)));
|
||||
match (*snapshot).parse_expr_res(Restrictions::CONST_EXPR, None) {
|
||||
Ok(expr) => {
|
||||
self.restore_snapshot(snapshot);
|
||||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue