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.
This commit is contained in:
@@ -740,7 +740,8 @@ impl<'tcx> SaveContext<'tcx> {
|
||||
_,
|
||||
)
|
||||
| Res::PrimTy(..)
|
||||
| Res::SelfTy { .. }
|
||||
| Res::SelfTyParam { .. }
|
||||
| Res::SelfTyAlias { .. }
|
||||
| Res::ToolMod
|
||||
| Res::NonMacroAttr(..)
|
||||
| Res::SelfCtor(..)
|
||||
@@ -805,7 +806,7 @@ impl<'tcx> SaveContext<'tcx> {
|
||||
|
||||
fn lookup_def_id(&self, ref_id: hir::HirId) -> Option<DefId> {
|
||||
match self.get_path_res(ref_id) {
|
||||
Res::PrimTy(_) | Res::SelfTy { .. } | Res::Err => None,
|
||||
Res::PrimTy(_) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } | Res::Err => None,
|
||||
def => def.opt_def_id(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user