diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-02-07 16:03:57 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-02-14 11:52:03 +1100 |
| commit | 5d65e8cc7aec3cdcd99367c58367a16c99a8ae22 (patch) | |
| tree | e13b976d2c856cf2ac16fd89d884305bf533bcd2 /src/librustc_save_analysis | |
| parent | e54494727855cd14229f5d456591ed2a2f027c46 (diff) | |
| download | rust-5d65e8cc7aec3cdcd99367c58367a16c99a8ae22.tar.gz rust-5d65e8cc7aec3cdcd99367c58367a16c99a8ae22.zip | |
Reduce the size of `hir::Expr`.
From 104 bytes to 72 bytes on x86-64. This slightly reduces instruction counts. Also add an assertion about the size.
Diffstat (limited to 'src/librustc_save_analysis')
| -rw-r--r-- | src/librustc_save_analysis/lib.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 8d20c44a5a4..8ab9a8e8dda 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -614,11 +614,16 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { Some(def) if def != HirDef::Err => def, _ => self.get_path_def(self.tcx.hir().get_parent_node(id)), } - }, + } + Node::Expr(&hir::Expr { node: hir::ExprKind::Struct(ref qpath, ..), .. - }) | + }) => { + let hir_id = self.tcx.hir().node_to_hir_id(id); + self.tables.qpath_def(qpath, hir_id) + } + Node::Expr(&hir::Expr { node: hir::ExprKind::Path(ref qpath), .. |
