Remove Resolver::create_stable_hashing_context.
It only has two uses. We can instead use `with_stable_hashing_context`, which has more than 30 uses.
This commit is contained in:
parent
93a1a8064d
commit
09eb497396
4 changed files with 26 additions and 29 deletions
|
|
@ -4570,7 +4570,6 @@ dependencies = [
|
|||
"rustc_macros",
|
||||
"rustc_metadata",
|
||||
"rustc_middle",
|
||||
"rustc_query_system",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"smallvec",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ rustc_index = { path = "../rustc_index" }
|
|||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_metadata = { path = "../rustc_metadata" }
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_query_system = { path = "../rustc_query_system" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ use rustc_middle::ty::{
|
|||
self, DelegationFnSig, DelegationInfo, Feed, MainDefinition, RegisteredTools,
|
||||
ResolverAstLowering, ResolverGlobalCtxt, TyCtxt, TyCtxtFeed, Visibility,
|
||||
};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_session::config::CrateType;
|
||||
use rustc_session::lint::builtin::PRIVATE_MACRO_USE;
|
||||
use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind, SyntaxContext, Transparency};
|
||||
|
|
@ -1839,10 +1838,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
|||
ResolverOutputs { global_ctxt, ast_lowering }
|
||||
}
|
||||
|
||||
fn create_stable_hashing_context(&self) -> StableHashingContext<'_> {
|
||||
StableHashingContext::new(self.tcx.sess, self.tcx.untracked())
|
||||
}
|
||||
|
||||
fn cstore(&self) -> FreezeReadGuard<'_, CStore> {
|
||||
CStore::from_tcx(self.tcx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,17 +222,19 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
|
|||
) -> LocalExpnId {
|
||||
let parent_module =
|
||||
parent_module_id.map(|module_id| self.local_def_id(module_id).to_def_id());
|
||||
let expn_id = LocalExpnId::fresh(
|
||||
ExpnData::allow_unstable(
|
||||
ExpnKind::AstPass(pass),
|
||||
call_site,
|
||||
self.tcx.sess.edition(),
|
||||
features.into(),
|
||||
None,
|
||||
parent_module,
|
||||
),
|
||||
self.create_stable_hashing_context(),
|
||||
);
|
||||
let expn_id = self.tcx.with_stable_hashing_context(|hcx| {
|
||||
LocalExpnId::fresh(
|
||||
ExpnData::allow_unstable(
|
||||
ExpnKind::AstPass(pass),
|
||||
call_site,
|
||||
self.tcx.sess.edition(),
|
||||
features.into(),
|
||||
None,
|
||||
parent_module,
|
||||
),
|
||||
hcx,
|
||||
)
|
||||
});
|
||||
|
||||
let parent_scope =
|
||||
parent_module.map_or(self.empty_module, |def_id| self.expect_module(def_id));
|
||||
|
|
@ -322,17 +324,19 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
|
|||
|
||||
let span = invoc.span();
|
||||
let def_id = if deleg_impl.is_some() { None } else { res.opt_def_id() };
|
||||
invoc_id.set_expn_data(
|
||||
ext.expn_data(
|
||||
parent_scope.expansion,
|
||||
span,
|
||||
fast_print_path(path),
|
||||
kind,
|
||||
def_id,
|
||||
def_id.map(|def_id| self.macro_def_scope(def_id).nearest_parent_mod()),
|
||||
),
|
||||
self.create_stable_hashing_context(),
|
||||
);
|
||||
self.tcx.with_stable_hashing_context(|hcx| {
|
||||
invoc_id.set_expn_data(
|
||||
ext.expn_data(
|
||||
parent_scope.expansion,
|
||||
span,
|
||||
fast_print_path(path),
|
||||
kind,
|
||||
def_id,
|
||||
def_id.map(|def_id| self.macro_def_scope(def_id).nearest_parent_mod()),
|
||||
),
|
||||
hcx,
|
||||
)
|
||||
});
|
||||
|
||||
Ok(ext)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue