X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_borrowck%2Fsrc%2Fregion_infer%2Fmod.rs;h=dabf61715ce58fb78bb4239dd40ab501932c061e;hb=05142a7e4495f09141fdd65f140fe44d8c200a9e;hp=fa9fe905256f5ac6daf84d49b27ebf43583b238d;hpb=6d7684101a51f1c375ec84aef5d2fbdeb214bbc2;p=rust.git diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index fa9fe905256..dabf61715ce 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -45,6 +45,7 @@ pub mod values; pub struct RegionInferenceContext<'tcx> { + pub var_infos: VarInfos, /// Contains the definition for every region variable. Region /// variables are identified by their index (`RegionVid`). The /// definition contains information about where the region came @@ -267,7 +268,7 @@ pub(crate) fn new( ) -> Self { // Create a RegionDefinition for each inference variable. let definitions: IndexVec<_, _> = var_infos - .into_iter() + .iter() .map(|info| RegionDefinition::new(info.universe, info.origin)) .collect(); @@ -292,6 +293,7 @@ pub(crate) fn new( Rc::new(member_constraints_in.into_mapped(|r| constraint_sccs.scc(r))); let mut result = Self { + var_infos, definitions, liveness_constraints, constraints, @@ -787,7 +789,7 @@ fn universe_compatible(&self, scc_b: ConstraintSccIndex, scc_a: ConstraintSccInd let universe_a = self.scc_universes[scc_a]; // Quick check: if scc_b's declared universe is a subset of - // scc_a's declared univese (typically, both are ROOT), then + // scc_a's declared universe (typically, both are ROOT), then // it cannot contain any problematic universe elements. if universe_a.can_name(self.scc_universes[scc_b]) { return true; @@ -942,14 +944,14 @@ fn try_promote_type_test( debug!("try_promote_type_test: ur={:?}", ur); - let non_local_ub = self.universal_region_relations.non_local_upper_bounds(&ur); + let non_local_ub = self.universal_region_relations.non_local_upper_bounds(ur); debug!("try_promote_type_test: non_local_ub={:?}", non_local_ub); // This is slightly too conservative. To show T: '1, given `'2: '1` // and `'3: '1` we only need to prove that T: '2 *or* T: '3, but to // avoid potential non-determinism we approximate this by requiring // T: '1 and T: '2. - for &upper_bound in non_local_ub { + for upper_bound in non_local_ub { debug_assert!(self.universal_regions.is_universal_region(upper_bound)); debug_assert!(!self.universal_regions.is_local_free_region(upper_bound)); @@ -1588,12 +1590,12 @@ fn try_propagate_universal_region_error( // always will.) We'll call them `shorter_fr+` -- they're ever // so slightly larger than `shorter_fr`. let shorter_fr_plus = - self.universal_region_relations.non_local_upper_bounds(&shorter_fr); + self.universal_region_relations.non_local_upper_bounds(shorter_fr); debug!( "try_propagate_universal_region_error: shorter_fr_plus={:?}", shorter_fr_plus ); - for &&fr in &shorter_fr_plus { + for fr in shorter_fr_plus { // Push the constraint `fr-: shorter_fr+` propagated_outlives_requirements.push(ClosureOutlivesRequirement { subject: ClosureOutlivesSubject::Region(fr_minus), @@ -1991,7 +1993,7 @@ fn check_member_constraints( .iter() .find_map(|constraint| { if let ConstraintCategory::Predicate(predicate_span) = constraint.category { - // We currentl'y doesn't store the `DefId` in the `ConstraintCategory` + // We currently do not store the `DefId` in the `ConstraintCategory` // for performances reasons. The error reporting code used by NLL only // uses the span, so this doesn't cause any problems at the moment. Some(ObligationCauseCode::BindingObligation(