Skip to content

Commit 43452a3

Browse files
committedNov 4, 2016
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.
1 parent 9366ba3 commit 43452a3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed
 

‎src/librustc/hir/lowering.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ impl<'a> LoweringContext<'a> {
12391239
}), outputs.iter().map(|out| self.lower_expr(&out.expr)).collect(),
12401240
inputs.iter().map(|&(_, ref input)| self.lower_expr(input)).collect()),
12411241
ExprKind::Struct(ref path, ref fields, ref maybe_expr) => {
1242-
hir::ExprStruct(self.lower_path(path),
1242+
hir::ExprStruct(P(self.lower_path(path)),
12431243
fields.iter().map(|x| self.lower_field(x)).collect(),
12441244
maybe_expr.as_ref().map(|x| self.lower_expr(x)))
12451245
}
@@ -1743,7 +1743,7 @@ impl<'a> LoweringContext<'a> {
17431743
e: Option<P<hir::Expr>>,
17441744
attrs: ThinVec<Attribute>) -> P<hir::Expr> {
17451745
let def = self.resolver.resolve_generated_global_path(&path, false);
1746-
let expr = self.expr(sp, hir::ExprStruct(path, fields, e), attrs);
1746+
let expr = self.expr(sp, hir::ExprStruct(P(path), fields, e), attrs);
17471747
self.resolver.record_resolution(expr.id, def);
17481748
expr
17491749
}

‎src/librustc/hir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ pub enum Expr_ {
946946
///
947947
/// For example, `Foo {x: 1, y: 2}`, or
948948
/// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`.
949-
ExprStruct(Path, HirVec<Field>, Option<P<Expr>>),
949+
ExprStruct(P<Path>, HirVec<Field>, Option<P<Expr>>),
950950

951951
/// An array literal constructed from one repeated element.
952952
///

‎src/librustc_const_eval/eval.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ pub fn const_expr_to_pat<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
314314
},
315315
}))
316316
.collect::<Result<_, _>>()?;
317-
PatKind::Struct(path.clone(), field_pats, false)
317+
PatKind::Struct((**path).clone(), field_pats, false)
318318
}
319319

320320
hir::ExprArray(ref exprs) => {

0 commit comments

Comments
 (0)
Please sign in to comment.