Add ErrorGuaranteed to ast::LitKind::Err, token::LitKind::Err.

This mostly works well, and eliminates a couple of delayed bugs.

One annoying thing is that we should really also add an
`ErrorGuaranteed` to `proc_macro::bridge::LitKind::Err`. But that's
difficult because `proc_macro` doesn't have access to `ErrorGuaranteed`,
so we have to fake it.
This commit is contained in:
Nicholas Nethercote 2024-02-14 20:12:05 +11:00
parent 332c57723a
commit 25ed6e43b0
26 changed files with 85 additions and 64 deletions

View file

@ -70,11 +70,11 @@ pub fn parse_meta<'a>(sess: &'a ParseSess, attr: &Attribute) -> PResult<'a, Meta
}
}
Err(err) => {
report_lit_error(sess, err, token_lit, expr.span);
let guar = report_lit_error(sess, err, token_lit, expr.span);
let lit = ast::MetaItemLit {
symbol: token_lit.symbol,
suffix: token_lit.suffix,
kind: ast::LitKind::Err,
kind: ast::LitKind::Err(guar),
span: expr.span,
};
MetaItemKind::NameValue(lit)