Allow LocalDefId as the argument to def_path_str

This commit is contained in:
Oli Scherer 2023-02-16 09:25:11 +00:00
parent e18d1f8d2e
commit 1ce80e210d
18 changed files with 68 additions and 54 deletions

View file

@ -80,6 +80,8 @@ use std::iter;
use std::mem;
use std::ops::{Bound, Deref};
use super::query::IntoQueryParam;
const TINY_CONST_EVAL_LIMIT: Limit = Limit(20);
pub trait OnDiskCache<'tcx>: rustc_data_structures::sync::Sync {
@ -822,7 +824,8 @@ impl<'tcx> TyCtxt<'tcx> {
self.features_query(())
}
pub fn def_key(self, id: DefId) -> rustc_hir::definitions::DefKey {
pub fn def_key(self, id: impl IntoQueryParam<DefId>) -> rustc_hir::definitions::DefKey {
let id = id.into_query_param();
// Accessing the DefKey is ok, since it is part of DefPathHash.
if let Some(id) = id.as_local() {
self.definitions_untracked().def_key(id)