add doc comments

This commit is contained in:
Takayuki Maeda 2022-03-10 19:34:42 +09:00
parent 3ded25204b
commit 2db8236857
2 changed files with 14 additions and 5 deletions

View file

@ -625,14 +625,14 @@ impl<'a> Parser<'a> {
} else if self.check_type() {
// Parse type argument.
let is_const_fn = self.look_ahead(1, |t| t.kind == token::OpenDelim(token::Paren));
let mut snapshot = self.diagnostic_snapshot();
let mut snapshot = self.create_snapshot_for_diagnostic();
match self.parse_ty() {
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);
self.restore_snapshot(snapshot);
return Ok(Some(self.dummy_const_arg_needs_braces(err, expr.span)));
}
}