Use token::Lit in ast::ExprKind::Lit.
Instead of `ast::Lit`. Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing. This commit changes the language very slightly. Some programs that used to not compile now will compile. This is because some invalid literals that are removed by `cfg` or attribute macros will no longer trigger errors. See this comment for more details: https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
This commit is contained in:
@@ -334,8 +334,8 @@ impl<'a> ExtCtxt<'a> {
|
||||
}
|
||||
|
||||
fn expr_lit(&self, span: Span, lit_kind: ast::LitKind) -> P<ast::Expr> {
|
||||
let lit = ast::Lit::from_lit_kind(lit_kind, span);
|
||||
self.expr(span, ast::ExprKind::Lit(lit))
|
||||
let token_lit = lit_kind.to_token_lit();
|
||||
self.expr(span, ast::ExprKind::Lit(token_lit))
|
||||
}
|
||||
|
||||
pub fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
|
||||
|
||||
Reference in New Issue
Block a user