diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-02-16 09:25:11 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-04-21 22:27:20 +0000 |
| commit | 1ce80e210d152619caa99b1bc030f57a352b657a (patch) | |
| tree | 428295e88e40acbf164390344816e790d143bc41 /compiler/rustc_middle/src/ty/context.rs | |
| parent | e18d1f8d2ea0b0feabf7794fb7f5868e3b243709 (diff) | |
| download | rust-1ce80e210d152619caa99b1bc030f57a352b657a.tar.gz rust-1ce80e210d152619caa99b1bc030f57a352b657a.zip | |
Allow `LocalDefId` as the argument to `def_path_str`
Diffstat (limited to 'compiler/rustc_middle/src/ty/context.rs')
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index af3a54148e1..8feabc02f93 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -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) |
