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:
parent
5f29a13a5b
commit
f07d4efc45
28 changed files with 224 additions and 185 deletions
|
@ -1422,7 +1422,9 @@ struct ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
|
|||
impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
fn path_is_private_type(&self, path: &hir::Path<'_>) -> bool {
|
||||
let did = match path.res {
|
||||
Res::PrimTy(..) | Res::SelfTy { .. } | Res::Err => return false,
|
||||
Res::PrimTy(..) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } | Res::Err => {
|
||||
return false;
|
||||
}
|
||||
res => res.def_id(),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue