fn check_universal_regions(
        &self,
        infcx: &InferCtxt<'_, 'tcx>,
        body: &Body<'tcx>,
        local_names: &IndexVec<Local, Option<Symbol>>,
        upvars: &[Upvar],
        mir_def_id: DefId,
        mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
        errors_buffer: &mut Vec<Diagnostic>,
        region_naming: &mut RegionErrorNamingCtx,
    ) {
        let mut outlives_suggestion = OutlivesSuggestionBuilder::new(mir_def_id, local_names);

        for (fr, fr_definition) in self.definitions.iter_enumerated() {
            match fr_definition.origin {
                NLLRegionVariableOrigin::FreeRegion => {
                    // Go through each of the universal regions `fr` and check that
                    // they did not grow too large, accumulating any requirements
                    // for our caller into the `outlives_requirements` vector.
                    self.check_universal_region(
                        infcx,
                        body,
                        local_names,
                        upvars,
                        mir_def_id,
                        fr,
                        &mut propagated_outlives_requirements,
                        &mut outlives_suggestion,
                        errors_buffer,
                        region_naming,
                    );
                }

                NLLRegionVariableOrigin::Placeholder(placeholder) => {
                    self.check_bound_universal_region(infcx, body, mir_def_id, fr, placeholder);
                }

                NLLRegionVariableOrigin::Existential { .. } => {
                    // nothing to check here
                }
            }
        }

        // Emit outlives suggestions
        outlives_suggestion.add_suggestion(body, self, infcx, errors_buffer, region_naming);
    }
/// Once regions have been propagated, this method is used to see
/// whether any of the constraints were too strong. In particular,
/// we want to check for a case where a universally quantified
/// region exceeded its bounds. Consider:
///
///     fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
///
/// In this case, returning `x` requires `&'a u32 <: &'b u32`
/// and hence we establish (transitively) a constraint that
/// `'a: 'b`. The `propagate_constraints` code above will
/// therefore add `end('a)` into the region for `'b` -- but we
/// have no evidence that `'b` outlives `'a`, so we want to report
/// an error.
///
/// If `propagated_outlives_requirements` is `Some`, then we will
/// push unsatisfied obligations into there. Otherwise, we'll
/// report them as errors.
Once regions have been propagated, this method is used to see
whether any of the constraints were too strong. In particular,
we want to check for a case where a universally quantified
region exceeded its bounds. Consider.





If `propagated_outlives_requirements` is `Some`, then we will
push unsatisfied obligations into there. Otherwise, we'll
report them as errors.
Once regions have been propagated this method is used to see whether any of the constraints were too strong . In particular we want to check for a case where a universally quantified region exceeded its bounds . Consider . If ` propagated_outlives_requirements ` is ` Some ` then we will push unsatisfied obligations into there . Otherwise we ' ll report them as errors .
fn check_universal_regions(
        &self,
        infcx: &InferCtxt<'_, 'tcx>,
        body: &Body<'tcx>,
        local_names: &IndexVec<Local, Option<Symbol>>,
        upvars: &[Upvar],
        mir_def_id: DefId,
        mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
        errors_buffer: &mut Vec<Diagnostic>,
        region_naming: &mut RegionErrorNamingCtx,
    ) {
        let mut outlives_suggestion = OutlivesSuggestionBuilder::new(mir_def_id, local_names);
        for (fr, fr_definition) in self.definitions.iter_enumerated() {
            match fr_definition.origin {
                NLLRegionVariableOrigin::FreeRegion => {
                    // Go through each of the universal regions `fr` and check that
                    // they did not grow too large, accumulating any requirements
                    // for our caller into the `outlives_requirements` vector.
                    self.check_universal_region(
                        infcx,
                        body,
                        local_names,
                        upvars,
                        mir_def_id,
                        fr,
                        &mut propagated_outlives_requirements,
                        &mut outlives_suggestion,
                        errors_buffer,
                        region_naming,
                    );
                }
                NLLRegionVariableOrigin::Placeholder(placeholder) => {
                    self.check_bound_universal_region(infcx, body, mir_def_id, fr, placeholder);
                }
                NLLRegionVariableOrigin::Existential { .. } => {
                    // nothing to check here
                }
            }
        }
        // Emit outlives suggestions
        outlives_suggestion.add_suggestion(body, self, infcx, errors_buffer, region_naming);
    }
fn check_universal_regions ( & self , infcx : & InferCtxt < ' _ , ' tcx > , body : & Body < ' tcx > , local_names : & IndexVec < Local , Option < Symbol > > , upvars : & [ Upvar ] , mir_def_id : DefId , mut propagated_outlives_requirements : Option < & mut Vec < ClosureOutlivesRequirement < ' tcx > > > , errors_buffer : & mut Vec < Diagnostic > , region_naming : & mut RegionErrorNamingCtx , ) { let mut outlives_suggestion = OutlivesSuggestionBuilder :: new ( mir_def_id , local_names ) ; for ( fr , fr_definition ) in self . definitions . iter_enumerated ( ) { match fr_definition . origin { NLLRegionVariableOrigin :: FreeRegion => { // Go through each of the universal regions `fr` and check that // they did not grow too large, accumulating any requirements // for our caller into the `outlives_requirements` vector. self . check_universal_region ( infcx , body , local_names , upvars , mir_def_id , fr , & mut propagated_outlives_requirements , & mut outlives_suggestion , errors_buffer , region_naming , ) ; } NLLRegionVariableOrigin :: Placeholder ( placeholder ) => { self . check_bound_universal_region ( infcx , body , mir_def_id , fr , placeholder ) ; } NLLRegionVariableOrigin :: Existential { .. } => { // nothing to check here } } } // Emit outlives suggestions outlives_suggestion . add_suggestion ( body , self , infcx , errors_buffer , region_naming ) ; }
Once regions have been propagated, this method is used to see
whether any of the constraints were too strong.
Once regions have been propagated this method is used to see whether any of the constraints were too strong .
&self
infcx
&InferCtxt<'_, 'tcx>
body
&Body<'tcx>
local_names
&IndexVec<Local, Option<Symbol>>
upvars
&[Upvar]
mir_def_id
DefId
propagated_outlives_requirements
Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>
errors_buffer
&mut Vec<Diagnostic>
region_naming
&mut RegionErrorNamingCtx