]> git.lizzy.rs Git - rust.git/commitdiff
fold_region: remove unused parameter
authorlcnr <rust@lcnr.de>
Mon, 27 Jun 2022 13:55:03 +0000 (15:55 +0200)
committerlcnr <rust@lcnr.de>
Mon, 27 Jun 2022 13:55:03 +0000 (15:55 +0200)
12 files changed:
compiler/rustc_borrowck/src/diagnostics/region_name.rs
compiler/rustc_borrowck/src/region_infer/mod.rs
compiler/rustc_borrowck/src/region_infer/opaque_types.rs
compiler/rustc_borrowck/src/renumber.rs
compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
compiler/rustc_borrowck/src/universal_regions.rs
compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs
compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
compiler/rustc_middle/src/ty/fold.rs
compiler/rustc_typeck/src/check/generator_interior.rs
compiler/rustc_typeck/src/collect.rs
compiler/rustc_typeck/src/collect/type_of.rs

index 8f3699553d92cd9a6fd6dc4877efb5a7b9a44cc8..e60e11f11df9fdd8addebe7a8eae426fd29fa017 100644 (file)
@@ -879,7 +879,7 @@ fn give_name_if_anonymous_region_appears_in_impl_signature(
         }
 
         let mut found = false;
-        tcx.fold_regions(tcx.type_of(body_parent_did), &mut true, |r: ty::Region<'tcx>, _| {
+        tcx.fold_regions(tcx.type_of(body_parent_did), |r: ty::Region<'tcx>, _| {
             if *r == ty::ReEarlyBound(region) {
                 found = true;
             }
index 0fe3b45bc7c4c30343070bc620408b060651f6c9..f5c9392948b24c5391f0107e981410359802132b 100644 (file)
@@ -1009,7 +1009,7 @@ fn try_promote_type_test_subject(
 
         debug!("try_promote_type_test_subject(ty = {:?})", ty);
 
-        let ty = tcx.fold_regions(ty, &mut false, |r, _depth| {
+        let ty = tcx.fold_regions(ty, |r, _depth| {
             let region_vid = self.to_region_vid(r);
 
             // The challenge if this. We have some region variable `r`
@@ -1289,7 +1289,7 @@ fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
     where
         T: TypeFoldable<'tcx>,
     {
-        tcx.fold_regions(value, &mut false, |r, _db| {
+        tcx.fold_regions(value, |r, _db| {
             let vid = self.to_region_vid(r);
             let scc = self.constraint_sccs.scc(vid);
             let repr = self.scc_representatives[scc];
index 810737587912b6e1795e33ce87b97110d2146f9d..d182c0cf4e8695cbbe2dae9f87ffc00f6154bb19 100644 (file)
@@ -59,7 +59,7 @@ pub(crate) fn infer_opaque_types(
             debug!(?concrete_type, ?substs);
 
             let mut subst_regions = vec![self.universal_regions.fr_static];
-            let universal_substs = infcx.tcx.fold_regions(substs, &mut false, |region, _| {
+            let universal_substs = infcx.tcx.fold_regions(substs, |region, _| {
                 if let ty::RePlaceholder(..) = region.kind() {
                     // Higher kinded regions don't need remapping, they don't refer to anything outside of this the substs.
                     return region;
@@ -91,7 +91,7 @@ pub(crate) fn infer_opaque_types(
             subst_regions.dedup();
 
             let universal_concrete_type =
-                infcx.tcx.fold_regions(concrete_type, &mut false, |region, _| match *region {
+                infcx.tcx.fold_regions(concrete_type, |region, _| match *region {
                     ty::ReVar(vid) => subst_regions
                         .iter()
                         .find(|ur_vid| self.eval_equal(vid, **ur_vid))
@@ -146,7 +146,7 @@ pub(crate) fn name_regions<T>(&self, tcx: TyCtxt<'tcx>, ty: T) -> T
     where
         T: TypeFoldable<'tcx>,
     {
-        tcx.fold_regions(ty, &mut false, |region, _| match *region {
+        tcx.fold_regions(ty, |region, _| match *region {
             ty::ReVar(vid) => {
                 // Find something that we can name
                 let upper_bound = self.approx_universal_upper_bound(vid);
index 2876d60527fe7714feacb811f933b9321f7ea16f..7a8ce621c5d0bfdc5e46a4e62e2f19e281599153 100644 (file)
@@ -31,7 +31,7 @@ pub fn renumber_regions<'tcx, T>(infcx: &InferCtxt<'_, 'tcx>, value: T) -> T
 where
     T: TypeFoldable<'tcx>,
 {
-    infcx.tcx.fold_regions(value, &mut false, |_region, _depth| {
+    infcx.tcx.fold_regions(value, |_region, _depth| {
         let origin = NllRegionVariableOrigin::Existential { from_forall: false };
         infcx.next_nll_region_var(origin)
     })
index 6f7adc218b2e2e29b8129f13ea4265efd84c1a67..5e33d9d25c223d4b29571c2672fd0d6e03e59ca9 100644 (file)
@@ -108,7 +108,7 @@ pub(super) fn convert(&mut self, query_constraint: &QueryOutlivesConstraint<'tcx
                 // create new region variables, which can't be done later when
                 // verifying these bounds.
                 if t1.has_placeholders() {
-                    t1 = tcx.fold_regions(t1, &mut false, |r, _| match *r {
+                    t1 = tcx.fold_regions(t1, |r, _| match *r {
                         ty::RePlaceholder(placeholder) => {
                             self.constraints.placeholder_region(self.infcx, placeholder)
                         }
index c2c093f9f2fc74e685b1589063b809c772f09702..89d84fcf09cfe66c7250f6435ce486ec2e54b557 100644 (file)
@@ -725,7 +725,7 @@ fn replace_free_regions_with_nll_infer_vars<T>(
     where
         T: TypeFoldable<'tcx>,
     {
-        self.tcx.fold_regions(value, &mut false, |_region, _depth| self.next_nll_region_var(origin))
+        self.tcx.fold_regions(value, |_region, _depth| self.next_nll_region_var(origin))
     }
 
     #[instrument(level = "debug", skip(self, indices))]
@@ -817,9 +817,7 @@ pub fn fold_to_region_vids<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
     where
         T: TypeFoldable<'tcx>,
     {
-        tcx.fold_regions(value, &mut false, |region, _| {
-            tcx.mk_region(ty::ReVar(self.to_region_vid(region)))
-        })
+        tcx.fold_regions(value, |region, _| tcx.mk_region(ty::ReVar(self.to_region_vid(region))))
     }
 }
 
index b9596cd10ed972a8f72b5f106e7b236e9a4286e1..42d52446ab6c72615887430790a430f2ae7a0c2b 100644 (file)
@@ -79,7 +79,7 @@ pub fn find_param_with_region<'tcx>(
             // May return None; sometimes the tables are not yet populated.
             let ty = fn_sig.inputs()[index];
             let mut found_anon_region = false;
-            let new_param_ty = tcx.fold_regions(ty, &mut false, |r, _| {
+            let new_param_ty = tcx.fold_regions(ty, |r, _| {
                 if r == anon_region {
                     found_anon_region = true;
                     replace_region
index 455de47acef1b97e681f3dfdadcb203cf6f137ac..68c709a2e24d3517464abeeeb38f8e514395bbca 100644 (file)
@@ -868,7 +868,7 @@ fn normalize<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
     where
         T: TypeFoldable<'tcx>,
     {
-        tcx.fold_regions(value, &mut false, |r, _db| match *r {
+        tcx.fold_regions(value, |r, _db| match *r {
             ty::ReVar(rid) => self.resolve_var(rid),
             _ => r,
         })
index b1b8bc13e2f1320a1578e4a8e3001f9232efe309..a6310ae5e66bda9b4aea10c176709f150d053c53 100644 (file)
@@ -465,13 +465,12 @@ impl<'tcx> TyCtxt<'tcx> {
     pub fn fold_regions<T>(
         self,
         value: T,
-        skipped_regions: &mut bool,
         mut f: impl FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>,
     ) -> T
     where
         T: TypeFoldable<'tcx>,
     {
-        value.fold_with(&mut RegionFolder::new(self, skipped_regions, &mut f))
+        value.fold_with(&mut RegionFolder::new(self, &mut f))
     }
 
     /// Invoke `callback` on every region appearing free in `value`.
@@ -579,7 +578,6 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
 
 pub struct RegionFolder<'a, 'tcx> {
     tcx: TyCtxt<'tcx>,
-    skipped_regions: &'a mut bool,
 
     /// Stores the index of a binder *just outside* the stuff we have
     /// visited.  So this begins as INNERMOST; when we pass through a
@@ -597,10 +595,9 @@ impl<'a, 'tcx> RegionFolder<'a, 'tcx> {
     #[inline]
     pub fn new(
         tcx: TyCtxt<'tcx>,
-        skipped_regions: &'a mut bool,
         fold_region_fn: &'a mut dyn FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>,
     ) -> RegionFolder<'a, 'tcx> {
-        RegionFolder { tcx, skipped_regions, current_index: ty::INNERMOST, fold_region_fn }
+        RegionFolder { tcx, current_index: ty::INNERMOST, fold_region_fn }
     }
 }
 
@@ -624,7 +621,6 @@ fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
         match *r {
             ty::ReLateBound(debruijn, _) if debruijn < self.current_index => {
                 debug!(?self.current_index, "skipped bound region");
-                *self.skipped_regions = true;
                 r
             }
             _ => {
index f09c7f51f47143a6e71ee84c551d745da7fc8b4a..6ee989070b429ebff0d1b1e00ba21f2363bd5fd3 100644 (file)
@@ -225,7 +225,7 @@ pub fn resolve_interior<'a, 'tcx>(
                 // Note that each region slot in the types gets a new fresh late bound region,
                 // which means that none of the regions inside relate to any other, even if
                 // typeck had previously found constraints that would cause them to be related.
-                let folded = fcx.tcx.fold_regions(erased, &mut false, |_, current_depth| {
+                let folded = fcx.tcx.fold_regions(erased, |_, current_depth| {
                     let br = ty::BoundRegion {
                         var: ty::BoundVar::from_u32(counter),
                         kind: ty::BrAnon(counter),
index 1f2e6ad86bd6dcaf50c0be2ae8a2059b9ebc77e6..2a52167c59767fafc5ba72862e8142568fcada24 100644 (file)
@@ -393,7 +393,7 @@ fn ty_infer(&self, _: Option<&ty::GenericParamDef>, span: Span) -> Ty<'tcx> {
     }
 
     fn ct_infer(&self, ty: Ty<'tcx>, _: Option<&ty::GenericParamDef>, span: Span) -> Const<'tcx> {
-        let ty = self.tcx.fold_regions(ty, &mut false, |r, _| match *r {
+        let ty = self.tcx.fold_regions(ty, |r, _| match *r {
             ty::ReErased => self.tcx.lifetimes.re_static,
             _ => r,
         });
@@ -1917,7 +1917,7 @@ fn infer_return_ty_for_fn_sig<'tcx>(
         Some(ty) => {
             let fn_sig = tcx.typeck(def_id).liberated_fn_sigs()[hir_id];
             // Typeck doesn't expect erased regions to be returned from `type_of`.
-            let fn_sig = tcx.fold_regions(fn_sig, &mut false, |r, _| match *r {
+            let fn_sig = tcx.fold_regions(fn_sig, |r, _| match *r {
                 ty::ReErased => tcx.lifetimes.re_static,
                 _ => r,
             });
index 7011dd6e15c21336c8eb538e14420c1a44f1693e..6ee2b5449167c3701590ee6031d9f070ea52b000 100644 (file)
@@ -772,7 +772,7 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
     }
 
     // Typeck doesn't expect erased regions to be returned from `type_of`.
-    tcx.fold_regions(ty, &mut false, |r, _| match *r {
+    tcx.fold_regions(ty, |r, _| match *r {
         ty::ReErased => tcx.lifetimes.re_static,
         _ => r,
     })