Make QueryConfig argument a type.
This commit is contained in:
parent
a17dd36084
commit
8c1c90bb5c
@ -1,3 +1,5 @@
|
|||||||
|
//! Query configuration and description traits.
|
||||||
|
|
||||||
use crate::dep_graph::SerializedDepNodeIndex;
|
use crate::dep_graph::SerializedDepNodeIndex;
|
||||||
use crate::dep_graph::{DepKind, DepNode};
|
use crate::dep_graph::{DepKind, DepNode};
|
||||||
use crate::ty::query::caches::QueryCache;
|
use crate::ty::query::caches::QueryCache;
|
||||||
@ -13,11 +15,7 @@ use std::borrow::Cow;
|
|||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
// Query configuration and description traits.
|
pub trait QueryConfig<CTX> {
|
||||||
|
|
||||||
// FIXME(eddyb) false positive, the lifetime parameter is used for `Key`/`Value`.
|
|
||||||
#[allow(unused_lifetimes)]
|
|
||||||
pub trait QueryConfig<'tcx> {
|
|
||||||
const NAME: &'static str;
|
const NAME: &'static str;
|
||||||
const CATEGORY: ProfileCategory;
|
const CATEGORY: ProfileCategory;
|
||||||
|
|
||||||
@ -25,7 +23,7 @@ pub trait QueryConfig<'tcx> {
|
|||||||
type Value: Clone;
|
type Value: Clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) trait QueryAccessors<'tcx>: QueryConfig<'tcx> {
|
pub(crate) trait QueryAccessors<'tcx>: QueryConfig<TyCtxt<'tcx>> {
|
||||||
const ANON: bool;
|
const ANON: bool;
|
||||||
const EVAL_ALWAYS: bool;
|
const EVAL_ALWAYS: bool;
|
||||||
const DEP_KIND: DepKind;
|
const DEP_KIND: DepKind;
|
||||||
|
@ -956,7 +956,7 @@ macro_rules! define_queries_inner {
|
|||||||
})*
|
})*
|
||||||
}
|
}
|
||||||
|
|
||||||
$(impl<$tcx> QueryConfig<$tcx> for queries::$name<$tcx> {
|
$(impl<$tcx> QueryConfig<TyCtxt<$tcx>> for queries::$name<$tcx> {
|
||||||
type Key = $K;
|
type Key = $K;
|
||||||
type Value = $V;
|
type Value = $V;
|
||||||
const NAME: &'static str = stringify!($name);
|
const NAME: &'static str = stringify!($name);
|
||||||
|
@ -37,7 +37,7 @@ macro_rules! provide {
|
|||||||
$(fn $name<$lt: $lt, T: IntoArgs>(
|
$(fn $name<$lt: $lt, T: IntoArgs>(
|
||||||
$tcx: TyCtxt<$lt>,
|
$tcx: TyCtxt<$lt>,
|
||||||
def_id_arg: T,
|
def_id_arg: T,
|
||||||
) -> <ty::queries::$name<$lt> as QueryConfig<$lt>>::Value {
|
) -> <ty::queries::$name<$lt> as QueryConfig<TyCtxt<$lt>>>::Value {
|
||||||
let _prof_timer =
|
let _prof_timer =
|
||||||
$tcx.prof.generic_activity("metadata_decode_entry");
|
$tcx.prof.generic_activity("metadata_decode_entry");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user