diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-09-16 11:45:33 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-09-29 08:44:52 +1000 |
| commit | f07d4efc4555c4154fb408b2d230fb72ad53b8be (patch) | |
| tree | 2aadca19dd99db6660b00c1ed969b5904d069b81 /compiler/rustc_privacy/src | |
| parent | 5f29a13a5b985229fce5fbb75f9af838734ad264 (diff) | |
| download | rust-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_privacy/src')
| -rw-r--r-- | compiler/rustc_privacy/src/lib.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 7ab07a671c4..841e3ebb2a1 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -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(), }; |
