Access stable_crate_id directly.
This commit is contained in:
parent
a246751ca1
commit
f387cffadb
@ -53,6 +53,7 @@ use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
|
||||
use rustc_session::config::{BorrowckMode, CrateType, OutputFilenames};
|
||||
use rustc_session::lint::{Level, Lint};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::def_id::StableCrateId;
|
||||
use rustc_span::source_map::MultiSpan;
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
@ -1264,6 +1265,11 @@ 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 def_path_debug_str(self, def_id: DefId) -> String {
|
||||
// We are explicitly not going through queries here in order to get
|
||||
// crate name and disambiguator since this code is called from debug!()
|
||||
|
@ -1022,8 +1022,7 @@ where
|
||||
E: 'a + OpaqueEncoder,
|
||||
{
|
||||
fn encode(&self, s: &mut CacheEncoder<'a, 'tcx, E>) -> Result<(), E::Error> {
|
||||
let def_path_hash = s.tcx.def_path_hash(self.as_def_id());
|
||||
def_path_hash.stable_crate_id().encode(s)
|
||||
s.tcx.stable_crate_id(*self).encode(s)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user