pub fn implied_outlives_bounds(
        &self,
        param_env: ty::ParamEnv<'tcx>,
        body_id: hir::HirId,
        ty: Ty<'tcx>,
        span: Span,
    ) -> Vec<OutlivesBound<'tcx>> {
        debug!("implied_outlives_bounds(ty = {:?})", ty);

        let mut orig_values = OriginalQueryValues::default();
        let key = self.canonicalize_query(&param_env.and(ty), &mut orig_values);
        let result = match self.tcx.implied_outlives_bounds(key) {
            Ok(r) => r,
            Err(NoSolution) => {
                self.tcx.sess.delay_span_bug(
                    span,
                    "implied_outlives_bounds failed to solve all obligations",
                );
                return vec![];
            }
        };
        assert!(result.value.is_proven());

        let result = self.instantiate_query_response_and_region_obligations(
            &ObligationCause::misc(span, body_id),
            param_env,
            &orig_values,
            &result,
        );
        debug!("implied_outlives_bounds for {:?}: {:#?}", ty, result);
        let result = match result {
            Ok(v) => v,
            Err(_) => {
                self.tcx.sess.delay_span_bug(span, "implied_outlives_bounds failed to instantiate");
                return vec![];
            }
        };

        // Instantiation may have produced new inference variables and constraints on those
        // variables. Process these constraints.
        let mut fulfill_cx = FulfillmentContext::new();
        fulfill_cx.register_predicate_obligations(self, result.obligations);
        if fulfill_cx.select_all_or_error(self).is_err() {
            self.tcx.sess.delay_span_bug(
                span,
                "implied_outlives_bounds failed to solve obligations from instantiation",
            );
        }

        result.value
    }
/// Implied bounds are region relationships that we deduce
/// automatically. The idea is that (e.g.) a caller must check that a
/// function's argument types are well-formed immediately before
/// calling that fn, and hence the *callee* can assume that its
/// argument types are well-formed. This may imply certain relationships
/// between generic parameters. For example:
///
///     fn foo<'a,T>(x: &'a T)
///
/// can only be called with a `'a` and `T` such that `&'a T` is WF.
/// For `&'a T` to be WF, `T: 'a` must hold. So we can assume `T: 'a`.
///
/// # Parameters
///
/// - `param_env`, the where-clauses in scope
/// - `body_id`, the body-id to use when normalizing assoc types.
///   Note that this may cause outlives obligations to be injected
///   into the inference context with this body-id.
/// - `ty`, the type that we are supposed to assume is WF.
/// - `span`, a span to use when normalizing, hopefully not important,
///   might be useful if a `bug!` occurs.
Implied bounds are region relationships that we deduce
automatically. The idea is that  a caller must check that a
function's argument types are well-formed immediately before
calling that fn, and hence the *callee* can assume that its
argument types are well-formed. This may imply certain relationships
between generic parameters. For example.




Implied bounds are region relationships that we deduce automatically . The idea is that a caller must check that a function ' s argument types are well - formed immediately before calling that fn and hence the * callee * can assume that its argument types are well - formed . This may imply certain relationships between generic parameters . For example .
pub fn implied_outlives_bounds(
        &self,
        param_env: ty::ParamEnv<'tcx>,
        body_id: hir::HirId,
        ty: Ty<'tcx>,
        span: Span,
    ) -> Vec<OutlivesBound<'tcx>> {
        debug!("implied_outlives_bounds(ty = {:?})", ty);
        let mut orig_values = OriginalQueryValues::default();
        let key = self.canonicalize_query(&param_env.and(ty), &mut orig_values);
        let result = match self.tcx.implied_outlives_bounds(key) {
            Ok(r) => r,
            Err(NoSolution) => {
                self.tcx.sess.delay_span_bug(
                    span,
                    "implied_outlives_bounds failed to solve all obligations",
                );
                return vec![];
            }
        };
        assert!(result.value.is_proven());
        let result = self.instantiate_query_response_and_region_obligations(
            &ObligationCause::misc(span, body_id),
            param_env,
            &orig_values,
            &result,
        );
        debug!("implied_outlives_bounds for {:?}: {:#?}", ty, result);
        let result = match result {
            Ok(v) => v,
            Err(_) => {
                self.tcx.sess.delay_span_bug(span, "implied_outlives_bounds failed to instantiate");
                return vec![];
            }
        };
        // Instantiation may have produced new inference variables and constraints on those
        // variables. Process these constraints.
        let mut fulfill_cx = FulfillmentContext::new();
        fulfill_cx.register_predicate_obligations(self, result.obligations);
        if fulfill_cx.select_all_or_error(self).is_err() {
            self.tcx.sess.delay_span_bug(
                span,
                "implied_outlives_bounds failed to solve obligations from instantiation",
            );
        }
        result.value
    }
pub fn implied_outlives_bounds ( & self , param_env : ty :: ParamEnv < ' tcx > , body_id : hir :: HirId , ty : Ty < ' tcx > , span : Span , ) -> Vec < OutlivesBound < ' tcx > > { debug ! ( " " ty ) ; let mut orig_values = OriginalQueryValues :: default ( ) ; let key = self . canonicalize_query ( & param_env . and ( ty ) , & mut orig_values ) ; let result = match self . tcx . implied_outlives_bounds ( key ) { Ok ( r ) => r , Err ( NoSolution ) => { self . tcx . sess . delay_span_bug ( span , " " , ) ; return vec ! [ ] ; } } ; assert ! ( result value is_proven ( ) ) ; let result = self . instantiate_query_response_and_region_obligations ( & ObligationCause :: misc ( span , body_id ) , param_env , & orig_values , & result , ) ; debug ! ( " " ty result ) ; let result = match result { Ok ( v ) => v , Err ( _ ) => { self . tcx . sess . delay_span_bug ( span , " " ) ; return vec ! [ ] ; } } ; // Instantiation may have produced new inference variables and constraints on those // variables. Process these constraints. let mut fulfill_cx = FulfillmentContext :: new ( ) ; fulfill_cx . register_predicate_obligations ( self , result . obligations ) ; if fulfill_cx . select_all_or_error ( self ) . is_err ( ) { self . tcx . sess . delay_span_bug ( span , " " , ) ; } result . value }
Implied bounds are region relationships that we deduce
automatically.
Implied bounds are region relationships that we deduce automatically .
&self
param_env
ty::ParamEnv<'tcx>
, the where-clauses in scope
the where - clauses in scope
body_id
hir::HirId
, the body-id to use when normalizing assoc types.
Note that this may cause outlives obligations to be injected
into the inference context with this body-id.
the body - id to use when normalizing assoc types . Note that this may cause outlives obligations to be injected into the inference context with this body - id .
ty
Ty<'tcx>
, the type that we are supposed to assume is WF.
the type that we are supposed to assume is WF .
span
Span
, a span to use when normalizing, hopefully not important,
might be useful if a `bug!` occurs.
a span to use when normalizing hopefully not important might be useful if a ` bug! ` occurs .