diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index e558d94551671..dd5d4b8f6afff 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3705,7 +3705,7 @@ impl<'a> LoweringContext<'a> { let ohs = P(self.lower_expr(ohs)); hir::ExprKind::Unary(op, ohs) } - ExprKind::Lit(ref l) => hir::ExprKind::Lit(P((**l).clone())), + ExprKind::Lit(ref l) => hir::ExprKind::Lit(P((*l).clone())), ExprKind::Cast(ref expr, ref ty) => { let expr = P(self.lower_expr(expr)); hir::ExprKind::Cast(expr, self.lower_ty(ty, ImplTraitContext::disallowed())) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index cfedda18a7e22..2f17bc0548cad 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1086,7 +1086,7 @@ pub enum ExprKind { /// A unary operation (For example: `!x`, `*x`) Unary(UnOp, P), /// A literal (For example: `1`, `"foo"`) - Lit(P), + Lit(Lit), /// A cast (`foo as f64`) Cast(P, P), Type(P, P), diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 1701c8da2c5bd..88ee80e60888f 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -491,7 +491,7 @@ impl DummyResult { pub fn raw_expr(sp: Span) -> P { P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Lit(P(source_map::respan(sp, ast::LitKind::Bool(false)))), + node: ast::ExprKind::Lit(source_map::respan(sp, ast::LitKind::Bool(false))), span: sp, attrs: ThinVec::new(), }) diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 7928ec1606b1d..cacec867cf198 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -695,7 +695,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } fn expr_lit(&self, sp: Span, lit: ast::LitKind) -> P { - self.expr(sp, ast::ExprKind::Lit(P(respan(sp, lit)))) + self.expr(sp, ast::ExprKind::Lit(respan(sp, lit))) } fn expr_usize(&self, span: Span, i: usize) -> P { self.expr_lit(span, ast::LitKind::Int(i as u128, diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 62bc9fae3b59a..ebc618a4c3cb3 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -274,7 +274,7 @@ pub mod rt { // FIXME: This is wrong P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Lit(P(self.clone())), + node: ast::ExprKind::Lit(self.clone()), span: DUMMY_SP, attrs: ThinVec::new(), }).to_tokens(cx) @@ -305,7 +305,7 @@ pub mod rt { let lit = ast::LitKind::Int(val as u128, ast::LitIntType::Signed($tag)); let lit = P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Lit(P(dummy_spanned(lit))), + node: ast::ExprKind::Lit(dummy_spanned(lit)), span: DUMMY_SP, attrs: ThinVec::new(), }); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c453b4b5597ff..ae5c936a70d72 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1957,7 +1957,7 @@ impl<'a> Parser<'a> { let minus_lo = self.span; let minus_present = self.eat(&token::BinOp(token::Minus)); let lo = self.span; - let literal = P(self.parse_lit()?); + let literal = self.parse_lit()?; let hi = self.prev_span; let expr = self.mk_expr(lo.to(hi), ExprKind::Lit(literal), ThinVec::new());