Shrink Expr_::ExprStruct
.
On 64-bit platforms this reduces the size of `Expr_` from 64 bytes to 56 bytes, and reduces the size of `Expr` from 88 bytes to 80 bytes.
This commit is contained in:
parent
9366ba3166
commit
43452a36ef
@ -1239,7 +1239,7 @@ fn make_struct(this: &mut LoweringContext,
|
||||
}), outputs.iter().map(|out| self.lower_expr(&out.expr)).collect(),
|
||||
inputs.iter().map(|&(_, ref input)| self.lower_expr(input)).collect()),
|
||||
ExprKind::Struct(ref path, ref fields, ref maybe_expr) => {
|
||||
hir::ExprStruct(self.lower_path(path),
|
||||
hir::ExprStruct(P(self.lower_path(path)),
|
||||
fields.iter().map(|x| self.lower_field(x)).collect(),
|
||||
maybe_expr.as_ref().map(|x| self.lower_expr(x)))
|
||||
}
|
||||
@ -1743,7 +1743,7 @@ fn expr_struct(&mut self,
|
||||
e: Option<P<hir::Expr>>,
|
||||
attrs: ThinVec<Attribute>) -> P<hir::Expr> {
|
||||
let def = self.resolver.resolve_generated_global_path(&path, false);
|
||||
let expr = self.expr(sp, hir::ExprStruct(path, fields, e), attrs);
|
||||
let expr = self.expr(sp, hir::ExprStruct(P(path), fields, e), attrs);
|
||||
self.resolver.record_resolution(expr.id, def);
|
||||
expr
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ pub enum Expr_ {
|
||||
///
|
||||
/// For example, `Foo {x: 1, y: 2}`, or
|
||||
/// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`.
|
||||
ExprStruct(Path, HirVec<Field>, Option<P<Expr>>),
|
||||
ExprStruct(P<Path>, HirVec<Field>, Option<P<Expr>>),
|
||||
|
||||
/// An array literal constructed from one repeated element.
|
||||
///
|
||||
|
@ -314,7 +314,7 @@ pub fn const_expr_to_pat<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
},
|
||||
}))
|
||||
.collect::<Result<_, _>>()?;
|
||||
PatKind::Struct(path.clone(), field_pats, false)
|
||||
PatKind::Struct((**path).clone(), field_pats, false)
|
||||
}
|
||||
|
||||
hir::ExprArray(ref exprs) => {
|
||||
|
Loading…
Reference in New Issue
Block a user