about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/thir
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-09-16 11:45:33 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-09-29 08:44:52 +1000
commitf07d4efc4555c4154fb408b2d230fb72ad53b8be (patch)
tree2aadca19dd99db6660b00c1ed969b5904d069b81 /compiler/rustc_mir_build/src/thir
parent5f29a13a5b985229fce5fbb75f9af838734ad264 (diff)
downloadrust-f07d4efc4555c4154fb408b2d230fb72ad53b8be.tar.gz
rust-f07d4efc4555c4154fb408b2d230fb72ad53b8be.zip
Shrink `hir::def::Res`.
`Res::SelfTy` currently has two `Option`s. When the second one is `Some`
the first one is never consulted. So we can split it into two variants,
`Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res`
from 24 bytes to 12. This then shrinks `hir::Path` and
`hir::PathSegment`, which are the HIR types that take up the most space.
Diffstat (limited to 'compiler/rustc_mir_build/src/thir')
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
index cd186421bb1..895af80bd7f 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
@@ -433,7 +433,8 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
                 | DefKind::AssocTy,
                 _,
             )
-            | Res::SelfTy { .. }
+            | Res::SelfTyParam { .. }
+            | Res::SelfTyAlias { .. }
             | Res::SelfCtor(..) => PatKind::Leaf { subpatterns },
             _ => {
                 let pattern_error = match res {