Separate hir_owner query into two queries to avoid using extensive data on incr comp most of the time

This commit is contained in:
Santiago Pastorino 2022-01-28 14:58:27 -03:00
parent a0bcce4884
commit d17eb78cf8
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
3 changed files with 29 additions and 16 deletions

View file

@ -52,10 +52,18 @@ rustc_queries! {
///
/// This can be conveniently accessed by methods on `tcx.hir()`.
/// Avoid calling this query directly.
query hir_owner(key: LocalDefId) -> hir::MaybeOwner<crate::hir::Owner<'tcx>> {
query hir_owner(key: LocalDefId) -> Option<crate::hir::Owner<'tcx>> {
desc { |tcx| "HIR owner of `{}`", tcx.def_path_str(key.to_def_id()) }
}
/// Gives access to the HIR ID for the given `LocalDefId` owner `key`.
///
/// This can be conveniently accessed by methods on `tcx.hir()`.
/// Avoid calling this query directly.
query local_def_id_to_hir_id(key: LocalDefId) -> hir::MaybeOwner<crate::hir::Owner<'tcx>> {
desc { |tcx| "HIR ID of `{}`", tcx.def_path_str(key.to_def_id()) }
}
/// Gives access to the HIR node's parent for the HIR owner `key`.
///
/// This can be conveniently accessed by methods on `tcx.hir()`.