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:
Aaron Hill 2020-10-05 15:32:25 -04:00
parent f317a93d4d
commit 8d11f90a16
No known key found for this signature in database
GPG key ID: B4087E510E98B164
9 changed files with 66 additions and 2 deletions

View file

@ -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),
}
}