1
Fork 0

rustc: Parameterize ty::Visibility over used ID

It allows using `LocalDefId` instead of `DefId` when possible, and also encode cheaper `Visibility<DefIndex>` into metadata.
This commit is contained in:
Vadim Petrochenkov 2022-08-28 00:10:06 +03:00
parent 0568b0a3de
commit d8d3b83e3a
24 changed files with 170 additions and 127 deletions

View file

@ -305,6 +305,12 @@ impl DefId {
}
}
impl From<LocalDefId> for DefId {
fn from(local: LocalDefId) -> DefId {
local.to_def_id()
}
}
impl<E: Encoder> Encodable<E> for DefId {
default fn encode(&self, s: &mut E) {
self.krate.encode(s);