Skip to content

Commit 82cc8a4

Browse files
committed
Rename query_helper_param_ty.
As `maybe_into_query_key`. Partly to use `key` instead of `param`, and also to make the link to the trait more obvious.
1 parent b7efa7c commit 82cc8a4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

compiler/rustc_middle/src/queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ use crate::mir::mono::{
101101
CodegenUnit, CollectionMode, MonoItem, MonoItemPartitions, NormalizationErrorInMono,
102102
};
103103
use crate::query::describe_as_module;
104-
use crate::query::plumbing::{define_callbacks, query_helper_param_ty};
104+
use crate::query::plumbing::{define_callbacks, maybe_into_query_key};
105105
use crate::traits::query::{
106106
CanonicalAliasGoal, CanonicalDropckOutlivesGoal, CanonicalImpliedOutlivesBoundsGoal,
107107
CanonicalMethodAutoderefStepsGoal, CanonicalPredicateGoal, CanonicalTypeOpAscribeUserTypeGoal,

compiler/rustc_middle/src/query/plumbing.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl<'tcx> TyCtxt<'tcx> {
267267
}
268268
}
269269

270-
macro_rules! query_helper_param_ty {
270+
macro_rules! maybe_into_query_key {
271271
(DefId) => { impl $crate::query::IntoQueryKey<DefId> };
272272
(LocalDefId) => { impl $crate::query::IntoQueryKey<LocalDefId> };
273273
($K:ty) => { $K };
@@ -276,7 +276,7 @@ macro_rules! query_helper_param_ty {
276276
macro_rules! define_callbacks {
277277
(
278278
// You might expect the key to be `$K:ty`, but it needs to be `$($K:tt)*` so that
279-
// `query_helper_param_ty!` can match on specific type names.
279+
// `maybe_into_query_key!` can match on specific type names.
280280
queries {
281281
$(
282282
$(#[$attr:meta])*
@@ -555,7 +555,7 @@ macro_rules! define_callbacks {
555555
$(#[$attr])*
556556
#[inline(always)]
557557
#[must_use]
558-
pub fn $name(self, key: query_helper_param_ty!($($K)*)) -> $V {
558+
pub fn $name(self, key: maybe_into_query_key!($($K)*)) -> $V {
559559
self.at(DUMMY_SP).$name(key)
560560
}
561561
)*
@@ -565,7 +565,7 @@ macro_rules! define_callbacks {
565565
$(
566566
$(#[$attr])*
567567
#[inline(always)]
568-
pub fn $name(self, key: query_helper_param_ty!($($K)*)) -> $V {
568+
pub fn $name(self, key: maybe_into_query_key!($($K)*)) -> $V {
569569
use $crate::query::{erase, inner};
570570

571571
erase::restore_val::<$V>(inner::query_get_at(
@@ -582,7 +582,7 @@ macro_rules! define_callbacks {
582582
$(
583583
$(#[$attr])*
584584
#[inline(always)]
585-
pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
585+
pub fn $name(self, key: maybe_into_query_key!($($K)*)) {
586586
$crate::query::inner::query_ensure_ok_or_done(
587587
self.tcx,
588588
&self.tcx.query_system.query_vtables.$name,
@@ -601,7 +601,7 @@ macro_rules! define_callbacks {
601601
#[inline(always)]
602602
pub fn $name(
603603
self,
604-
key: query_helper_param_ty!($($K)*),
604+
key: maybe_into_query_key!($($K)*),
605605
) -> Result<(), rustc_errors::ErrorGuaranteed> {
606606
$crate::query::inner::query_ensure_result(
607607
self.tcx,
@@ -616,7 +616,7 @@ macro_rules! define_callbacks {
616616
$(
617617
$(#[$attr])*
618618
#[inline(always)]
619-
pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
619+
pub fn $name(self, key: maybe_into_query_key!($($K)*)) {
620620
$crate::query::inner::query_ensure_ok_or_done(
621621
self.tcx,
622622
&self.tcx.query_system.query_vtables.$name,
@@ -650,7 +650,7 @@ macro_rules! define_callbacks {
650650

651651
// Re-export `macro_rules!` macros as normal items, so that they can be imported normally.
652652
pub(crate) use define_callbacks;
653-
pub(crate) use query_helper_param_ty;
653+
pub(crate) use maybe_into_query_key;
654654

655655
#[cold]
656656
pub(crate) fn default_query(name: &str, key: &dyn std::fmt::Debug) -> ! {

0 commit comments

Comments
 (0)