Skip to content

Commit ae4b14e

Browse files
committed
Use Lit rather than P<Lit> in hir::ExprKind.
It's simpler and makes some benchmark run up to 1% faster. It also makes `hir::ExprKind` more like `ast::ExprKind` (which underwent the equivalent change in #55777).
1 parent e2f221c commit ae4b14e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/librustc/hir/lowering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3775,7 +3775,7 @@ impl<'a> LoweringContext<'a> {
37753775
let ohs = P(self.lower_expr(ohs));
37763776
hir::ExprKind::Unary(op, ohs)
37773777
}
3778-
ExprKind::Lit(ref l) => hir::ExprKind::Lit(P((*l).clone())),
3778+
ExprKind::Lit(ref l) => hir::ExprKind::Lit((*l).clone()),
37793779
ExprKind::Cast(ref expr, ref ty) => {
37803780
let expr = P(self.lower_expr(expr));
37813781
hir::ExprKind::Cast(expr, self.lower_ty(ty, ImplTraitContext::disallowed()))

src/librustc/hir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ pub enum ExprKind {
14661466
/// A unary operation (For example: `!x`, `*x`)
14671467
Unary(UnOp, P<Expr>),
14681468
/// A literal (For example: `1`, `"foo"`)
1469-
Lit(P<Lit>),
1469+
Lit(Lit),
14701470
/// A cast (`foo as f64`)
14711471
Cast(P<Expr>, P<Ty>),
14721472
Type(P<Expr>, P<Ty>),

0 commit comments

Comments
 (0)