1 use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
2 use crate::traits::query::Fallible;
3 use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt};
5 pub use rustc_middle::traits::query::type_op::ProvePredicate;
7 impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
8 type QueryResponse = ();
12 key: &ParamEnvAnd<'tcx, Self>,
13 ) -> Option<Self::QueryResponse> {
14 // Proving Sized, very often on "obviously sized" types like
15 // `&T`, accounts for about 60% percentage of the predicates
16 // we have to prove. No need to canonicalize and all that for
18 if let ty::PredicateKind::Trait(trait_ref, _) = key.value.predicate.kind() {
19 if let Some(sized_def_id) = tcx.lang_items().sized_trait() {
20 if trait_ref.def_id() == sized_def_id {
21 if trait_ref.skip_binder().self_ty().is_trivially_sized(tcx) {
33 canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
34 ) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
35 tcx.type_op_prove_predicate(canonicalized)