use crate::dep_graph::{DepKind, DepNode, RecoverKey, SerializedDepNodeIndex};
use crate::mir;
-use crate::mir::interpret::GlobalId;
+use crate::mir::interpret::{GlobalId, LitToConstInput};
use crate::traits;
use crate::traits::query::{
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
no_force
desc { "get a &core::panic::Location referring to a span" }
}
+
+ query lit_to_const(
+ key: LitToConstInput<'tcx>
+ ) -> Result<&'tcx ty::Const<'tcx>, LitToConstError> {
+ no_force
+ desc { "converting literal to const" }
+ }
}
TypeChecking {
desc { "normalizing `{:?}`", goal }
}
- query substitute_normalize_and_test_predicates(key: (DefId, SubstsRef<'tcx>)) -> bool {
+ query substitute_normalize_and_test_predicates(key: (DefId, SubstsRef<'tcx>, traits::TraitQueryMode)) -> bool {
no_force
desc { |tcx|
- "testing substituted normalized predicates:`{}`",
- tcx.def_path_str(key.0)
+ "testing substituted normalized predicates in mode {:?}:`{}`",
+ key.2, tcx.def_path_str(key.0)
}
}
}
}
+impl<'tcx> Key for mir::interpret::LitToConstInput<'tcx> {
+ fn query_crate(&self) -> CrateNum {
+ LOCAL_CRATE
+ }
+
+ fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
+ DUMMY_SP
+ }
+}
+
impl Key for CrateNum {
fn query_crate(&self) -> CrateNum {
*self
}
}
+ impl<'tcx> Key for (DefId, SubstsRef<'tcx>, traits::TraitQueryMode) {
+ fn query_crate(&self) -> CrateNum {
+ self.0.krate
+ }
+ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
+ self.0.default_span(tcx)
+ }
+ }
+
impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) {
fn query_crate(&self) -> CrateNum {
self.1.def_id().krate