Skip to content

Commit

Permalink
Make tcx.stable_crate_id() faster
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Jul 6, 2021
1 parent e95bd03 commit ca935dd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ca935dd

Please sign in to comment.