1 use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
2 use crate::traits::query::outlives_bounds::OutlivesBound;
3 use crate::traits::query::Fallible;
4 use rustc_middle::ty::{ParamEnvAnd, Ty, TyCtxt};
6 #[derive(Clone, Debug, HashStable, TypeFoldable, Lift)]
7 pub struct ImpliedOutlivesBounds<'tcx> {
11 impl<'tcx> ImpliedOutlivesBounds<'tcx> {
12 pub fn new(ty: Ty<'tcx>) -> Self {
13 ImpliedOutlivesBounds { ty }
17 impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
18 type QueryResponse = Vec<OutlivesBound<'tcx>>;
22 _key: &ParamEnvAnd<'tcx, Self>,
23 ) -> Option<Self::QueryResponse> {
29 canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
30 ) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>> {
31 // FIXME this `unchecked_map` is only necessary because the
32 // query is defined as taking a `ParamEnvAnd<Ty>`; it should
33 // take a `ImpliedOutlivesBounds` instead
34 let canonicalized = canonicalized.unchecked_map(|ParamEnvAnd { param_env, value }| {
35 let ImpliedOutlivesBounds { ty } = value;
39 tcx.implied_outlives_bounds(canonicalized)