Record expansion_that_defined
into crate metadata
Fixes #77523 Now that hygiene serialization is implemented, we also need to record `expansion_that_defined` so that we properly handle a foreign `SyntaxContext`.
This commit is contained in:
parent
f317a93d4d
commit
8d11f90a16
9 changed files with 66 additions and 2 deletions
|
@ -191,6 +191,11 @@ rustc_queries! {
|
|||
eval_always
|
||||
desc { |tcx| "parent module of `{}`", tcx.def_path_str(key.to_def_id()) }
|
||||
}
|
||||
|
||||
/// Internal helper query. Use `tcx.expansion_that_defined` instead
|
||||
query expn_that_defined(key: DefId) -> rustc_span::ExpnId {
|
||||
desc { |tcx| "expansion that defined `{}`", tcx.def_path_str(key) }
|
||||
}
|
||||
}
|
||||
|
||||
Codegen {
|
||||
|
|
|
@ -3034,10 +3034,12 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
.hygienic_eq(def_name.span.ctxt(), self.expansion_that_defined(def_parent_def_id))
|
||||
}
|
||||
|
||||
fn expansion_that_defined(self, scope: DefId) -> ExpnId {
|
||||
pub fn expansion_that_defined(self, scope: DefId) -> ExpnId {
|
||||
match scope.as_local() {
|
||||
// Parsing and expansion aren't incremental, so we don't
|
||||
// need to go through a query for the same-crate case.
|
||||
Some(scope) => self.hir().definitions().expansion_that_defined(scope),
|
||||
None => ExpnId::root(),
|
||||
None => self.expn_that_defined(scope),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue