Skip to content

Commit

Permalink
Use Lit rather than P<Lit> in hir::ExprKind.
Browse files Browse the repository at this point in the history
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 rust-lang#55777).
  • Loading branch information
nnethercote committed Jan 16, 2019
1 parent e2f221c commit ae4b14e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3775,7 +3775,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((*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()))
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ pub enum ExprKind {
/// A unary operation (For example: `!x`, `*x`)
Unary(UnOp, P<Expr>),
/// A literal (For example: `1`, `"foo"`)
Lit(P<Lit>),
Lit(Lit),
/// A cast (`foo as f64`)
Cast(P<Expr>, P<Ty>),
Type(P<Expr>, P<Ty>),
Expand Down

0 comments on commit ae4b14e

Please sign in to comment.