Correct comments about untracked accesses.

This commit is contained in:
Camille GILLOT
2021-05-20 20:17:45 +02:00
parent f0e5e22806
commit 1119b48e02
5 changed files with 31 additions and 24 deletions

View File

@@ -1211,9 +1211,9 @@ impl<'tcx> TyCtxt<'tcx> {
}
pub fn def_key(self, id: DefId) -> rustc_hir::definitions::DefKey {
// Accessing the definitions is ok, since all its contents are tracked by the query system.
// Accessing the DefKey is ok, since it is part of DefPathHash.
if let Some(id) = id.as_local() {
self.hir().def_key(id)
self.untracked_resolutions.definitions.def_key(id)
} else {
self.untracked_resolutions.cstore.def_key(id)
}
@@ -1225,9 +1225,9 @@ impl<'tcx> TyCtxt<'tcx> {
/// Note that if `id` is not local to this crate, the result will
/// be a non-local `DefPath`.
pub fn def_path(self, id: DefId) -> rustc_hir::definitions::DefPath {
// Accessing the definitions is ok, since all its contents are tracked by the query system.
// Accessing the DefPath is ok, since it is part of DefPathHash.
if let Some(id) = id.as_local() {
self.hir().def_path(id)
self.untracked_resolutions.definitions.def_path(id)
} else {
self.untracked_resolutions.cstore.def_path(id)
}
@@ -1235,7 +1235,7 @@ impl<'tcx> TyCtxt<'tcx> {
#[inline]
pub fn def_path_hash(self, def_id: DefId) -> rustc_hir::definitions::DefPathHash {
// Accessing the definitions is ok, since all its contents are tracked by the query system.
// Accessing the DefPathHash is ok, it is incr. comp. stable.
if let Some(def_id) = def_id.as_local() {
self.untracked_resolutions.definitions.def_path_hash(def_id)
} else {

View File

@@ -1867,7 +1867,7 @@ impl<'tcx> TyCtxt<'tcx> {
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),
Some(scope) => self.resolutions(()).definitions.expansion_that_defined(scope),
None => self.expn_that_defined(scope),
}
}
@@ -1887,7 +1887,7 @@ impl<'tcx> TyCtxt<'tcx> {
match ident.span.normalize_to_macros_2_0_and_adjust(self.expansion_that_defined(scope))
{
Some(actual_expansion) => {
self.hir().definitions().parent_module_of_macro_def(actual_expansion)
self.resolutions(()).definitions.parent_module_of_macro_def(actual_expansion)
}
None => self.parent_module(block).to_def_id(),
};