[−][src]Trait rustc_trait_selection::traits::query::outlives_bounds::InferCtxtExt

pub trait InferCtxtExt<'tcx> {
    pub fn implied_outlives_bounds(
        &self,
        param_env: ParamEnv<'tcx>,
        body_id: HirId,
        ty: Ty<'tcx>,
        span: Span
    ) -> Vec<OutlivesBound<'tcx>>; }

Required methods

pub fn implied_outlives_bounds(
    &self,
    param_env: ParamEnv<'tcx>,
    body_id: HirId,
    ty: Ty<'tcx>,
    span: Span
) -> Vec<OutlivesBound<'tcx>>
[src]

Loading content...

Implementors

impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx>[src]

pub fn implied_outlives_bounds(
    &self,
    param_env: ParamEnv<'tcx>,
    body_id: HirId,
    ty: Ty<'tcx>,
    span: Span
) -> Vec<OutlivesBound<'tcx>>
[src]

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.
Loading content...