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:
@@ -102,14 +102,8 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
Res::Def(_, def_id) => self.check_def_id(def_id),
|
||||
Res::SelfTy { trait_: t, alias_to: i } => {
|
||||
if let Some(t) = t {
|
||||
self.check_def_id(t);
|
||||
}
|
||||
if let Some((i, _)) = i {
|
||||
self.check_def_id(i);
|
||||
}
|
||||
}
|
||||
Res::SelfTyParam { trait_: t } => self.check_def_id(t),
|
||||
Res::SelfTyAlias { alias_to: i, .. } => self.check_def_id(i),
|
||||
Res::ToolMod | Res::NonMacroAttr(..) | Res::Err => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user