Make tcx.stable_crate_id() faster
This commit is contained in:
parent
e95bd03f01
commit
ca935ddbf1
1 changed files with 6 additions and 2 deletions
|
@ -1299,8 +1299,12 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn stable_crate_id(self, cnum: CrateNum) -> StableCrateId {
|
||||
self.def_path_hash(cnum.as_def_id()).stable_crate_id()
|
||||
pub fn stable_crate_id(self, crate_num: CrateNum) -> StableCrateId {
|
||||
if crate_num == LOCAL_CRATE {
|
||||
self.sess.local_stable_crate_id()
|
||||
} else {
|
||||
self.cstore.stable_crate_id_untracked(crate_num)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn def_path_debug_str(self, def_id: DefId) -> String {
|
||||
|
|
Loading…
Add table
Reference in a new issue