Skip to content

Commit 192ad03

Browse files
Remove unncessary outlives and captures from RPITs
1 parent 5a22964 commit 192ad03

File tree

95 files changed

+179
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+179
-231
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ impl<FieldIdx: Idx> FieldsShape<FieldIdx> {
12511251

12521252
/// Gets source indices of the fields by increasing offsets.
12531253
#[inline]
1254-
pub fn index_by_increasing_offset(&self) -> impl ExactSizeIterator<Item = usize> + '_ {
1254+
pub fn index_by_increasing_offset(&self) -> impl ExactSizeIterator<Item = usize> {
12551255
let mut inverse_small = [0u8; 64];
12561256
let mut inverse_big = IndexVec::new();
12571257
let use_small = self.count() <= inverse_small.len();

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ use rustc_ast::node_id::NodeMap;
4545
use rustc_ast::ptr::P;
4646
use rustc_ast::{self as ast, *};
4747
use rustc_ast_pretty::pprust;
48-
use rustc_data_structures::captures::Captures;
4948
use rustc_data_structures::fingerprint::Fingerprint;
5049
use rustc_data_structures::fx::FxIndexSet;
5150
use rustc_data_structures::sorted_map::SortedMap;
@@ -2101,7 +2100,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21012100
&'s mut self,
21022101
params: &'s [GenericParam],
21032102
source: hir::GenericParamSource,
2104-
) -> impl Iterator<Item = hir::GenericParam<'hir>> + Captures<'a> + Captures<'s> {
2103+
) -> impl Iterator<Item = hir::GenericParam<'hir>> {
21052104
params.iter().map(move |param| self.lower_generic_param(param, source))
21062105
}
21072106

@@ -2265,7 +2264,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22652264
&'s mut self,
22662265
bounds: &'s [GenericBound],
22672266
itctx: ImplTraitContext,
2268-
) -> impl Iterator<Item = hir::GenericBound<'hir>> + Captures<'s> + Captures<'a> {
2267+
) -> impl Iterator<Item = hir::GenericBound<'hir>> {
22692268
bounds.iter().map(move |bound| self.lower_param_bound(bound, itctx))
22702269
}
22712270

compiler/rustc_attr/src/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,22 +1166,22 @@ pub fn find_transparency(
11661166
pub fn allow_internal_unstable<'a>(
11671167
sess: &'a Session,
11681168
attrs: &'a [Attribute],
1169-
) -> impl Iterator<Item = Symbol> + 'a {
1169+
) -> impl Iterator<Item = Symbol> {
11701170
allow_unstable(sess, attrs, sym::allow_internal_unstable)
11711171
}
11721172

11731173
pub fn rustc_allow_const_fn_unstable<'a>(
11741174
sess: &'a Session,
11751175
attrs: &'a [Attribute],
1176-
) -> impl Iterator<Item = Symbol> + 'a {
1176+
) -> impl Iterator<Item = Symbol> {
11771177
allow_unstable(sess, attrs, sym::rustc_allow_const_fn_unstable)
11781178
}
11791179

11801180
fn allow_unstable<'a>(
11811181
sess: &'a Session,
11821182
attrs: &'a [Attribute],
11831183
symbol: Symbol,
1184-
) -> impl Iterator<Item = Symbol> + 'a {
1184+
) -> impl Iterator<Item = Symbol> {
11851185
let attrs = attr::filter_by_name(attrs, symbol);
11861186
let list = attrs
11871187
.filter_map(move |attr| {

compiler/rustc_borrowck/src/borrow_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl<'tcx> BorrowSet<'tcx> {
159159
self.location_map.len()
160160
}
161161

162-
pub(crate) fn indices(&self) -> impl Iterator<Item = BorrowIndex> {
162+
pub(crate) fn indices(&self) -> impl Iterator<Item = BorrowIndex> + 'static {
163163
BorrowIndex::ZERO..BorrowIndex::from_usize(self.len())
164164
}
165165

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::ops::ControlFlow;
88

99
use either::Either;
1010
use hir::{ClosureKind, Path};
11-
use rustc_data_structures::captures::Captures;
1211
use rustc_data_structures::fx::FxIndexSet;
1312
use rustc_errors::codes::*;
1413
use rustc_errors::{struct_span_code_err, Applicability, Diag, MultiSpan};
@@ -3544,7 +3543,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
35443543
fn predecessor_locations<'tcx, 'a>(
35453544
body: &'a mir::Body<'tcx>,
35463545
location: Location,
3547-
) -> impl Iterator<Item = Location> + Captures<'tcx> + 'a {
3546+
) -> impl Iterator<Item = Location> {
35483547
if location.statement_index == 0 {
35493548
let predecessors = body.basic_blocks.predecessors()[location.block].to_vec();
35503549
Either::Left(predecessors.into_iter().map(move |bb| body.terminator_loc(bb)))

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
824824
/// help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as
825825
/// a constraint
826826
/// |
827-
/// LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + 'a {
827+
/// LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
828828
/// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
829829
/// ```
830830
#[allow(rustc::diagnostic_outside_of_impl)]

compiler/rustc_borrowck/src/member_constraints.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::hash::Hash;
22
use std::ops::Index;
33

4-
use rustc_data_structures::captures::Captures;
54
use rustc_data_structures::fx::FxIndexMap;
65
use rustc_index::{IndexSlice, IndexVec};
76
use rustc_middle::infer::MemberConstraint;
@@ -150,9 +149,7 @@ impl<'tcx, R> MemberConstraintSet<'tcx, R>
150149
where
151150
R: Copy + Hash + Eq,
152151
{
153-
pub(crate) fn all_indices(
154-
&self,
155-
) -> impl Iterator<Item = NllMemberConstraintIndex> + Captures<'tcx> + '_ {
152+
pub(crate) fn all_indices(&self) -> impl Iterator<Item = NllMemberConstraintIndex> {
156153
self.constraints.indices()
157154
}
158155

@@ -162,7 +159,7 @@ where
162159
pub(crate) fn indices(
163160
&self,
164161
member_region_vid: R,
165-
) -> impl Iterator<Item = NllMemberConstraintIndex> + Captures<'tcx> + '_ {
162+
) -> impl Iterator<Item = NllMemberConstraintIndex> {
166163
let mut next = self.first_constraints.get(&member_region_vid).cloned();
167164
std::iter::from_fn(move || -> Option<NllMemberConstraintIndex> {
168165
if let Some(current) = next {

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
552552
}
553553

554554
/// Returns an iterator over all the region indices.
555-
pub fn regions(&self) -> impl Iterator<Item = RegionVid> + 'tcx {
555+
pub fn regions(&self) -> impl Iterator<Item = RegionVid> {
556556
self.definitions.indices()
557557
}
558558

@@ -565,7 +565,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
565565
}
566566

567567
/// Returns an iterator over all the outlives constraints.
568-
pub fn outlives_constraints(&self) -> impl Iterator<Item = OutlivesConstraint<'tcx>> + '_ {
568+
pub fn outlives_constraints(&self) -> impl Iterator<Item = OutlivesConstraint<'tcx>> {
569569
self.constraints.outlives().iter().copied()
570570
}
571571

@@ -605,7 +605,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
605605
pub(crate) fn placeholders_contained_in<'a>(
606606
&'a self,
607607
r: RegionVid,
608-
) -> impl Iterator<Item = ty::PlaceholderRegion> + 'a {
608+
) -> impl Iterator<Item = ty::PlaceholderRegion> {
609609
let scc = self.constraint_sccs.scc(r);
610610
self.scc_values.placeholders_contained_in(scc)
611611
}

compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl ReverseSccGraph {
2323
pub(super) fn upper_bounds<'a>(
2424
&'a self,
2525
scc0: ConstraintSccIndex,
26-
) -> impl Iterator<Item = RegionVid> + 'a {
26+
) -> impl Iterator<Item = RegionVid> {
2727
let mut duplicates = FxIndexSet::default();
2828
graph::depth_first_search(&self.graph, scc0)
2929
.flat_map(move |scc1| {

compiler/rustc_borrowck/src/region_infer/values.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ impl LivenessValues {
9999
}
100100

101101
/// Iterate through each region that has a value in this set.
102-
pub(crate) fn regions(&self) -> impl Iterator<Item = RegionVid> + '_ {
102+
pub(crate) fn regions(&self) -> impl Iterator<Item = RegionVid> {
103103
self.points.as_ref().expect("use with_specific_points").rows()
104104
}
105105

106106
/// Iterate through each region that has a value in this set.
107107
// We are passing query instability implications to the caller.
108108
#[rustc_lint_query_instability]
109109
#[allow(rustc::potential_query_instability)]
110-
pub(crate) fn live_regions_unordered(&self) -> impl Iterator<Item = RegionVid> + '_ {
110+
pub(crate) fn live_regions_unordered(&self) -> impl Iterator<Item = RegionVid> {
111111
self.live_regions.as_ref().unwrap().iter().copied()
112112
}
113113

@@ -176,7 +176,7 @@ impl LivenessValues {
176176
}
177177

178178
/// Returns an iterator of all the points where `region` is live.
179-
fn live_points(&self, region: RegionVid) -> impl Iterator<Item = PointIndex> + '_ {
179+
fn live_points(&self, region: RegionVid) -> impl Iterator<Item = PointIndex> {
180180
let Some(points) = &self.points else {
181181
unreachable!(
182182
"Should be using LivenessValues::with_specific_points to ask whether live at a location"
@@ -362,7 +362,7 @@ impl<N: Idx> RegionValues<N> {
362362
}
363363

364364
/// Returns the locations contained within a given region `r`.
365-
pub(crate) fn locations_outlived_by<'a>(&'a self, r: N) -> impl Iterator<Item = Location> + 'a {
365+
pub(crate) fn locations_outlived_by<'a>(&'a self, r: N) -> impl Iterator<Item = Location> {
366366
self.points.row(r).into_iter().flat_map(move |set| {
367367
set.iter()
368368
.take_while(move |&p| self.elements.point_in_range(p))
@@ -374,15 +374,15 @@ impl<N: Idx> RegionValues<N> {
374374
pub(crate) fn universal_regions_outlived_by<'a>(
375375
&'a self,
376376
r: N,
377-
) -> impl Iterator<Item = RegionVid> + 'a {
377+
) -> impl Iterator<Item = RegionVid> {
378378
self.free_regions.row(r).into_iter().flat_map(|set| set.iter())
379379
}
380380

381381
/// Returns all the elements contained in a given region's value.
382382
pub(crate) fn placeholders_contained_in<'a>(
383383
&'a self,
384384
r: N,
385-
) -> impl Iterator<Item = ty::PlaceholderRegion> + 'a {
385+
) -> impl Iterator<Item = ty::PlaceholderRegion> {
386386
self.placeholders
387387
.row(r)
388388
.into_iter()
@@ -391,10 +391,7 @@ impl<N: Idx> RegionValues<N> {
391391
}
392392

393393
/// Returns all the elements contained in a given region's value.
394-
pub(crate) fn elements_contained_in<'a>(
395-
&'a self,
396-
r: N,
397-
) -> impl Iterator<Item = RegionElement> + 'a {
394+
pub(crate) fn elements_contained_in<'a>(&'a self, r: N) -> impl Iterator<Item = RegionElement> {
398395
let points_iter = self.locations_outlived_by(r).map(RegionElement::Location);
399396

400397
let free_regions_iter =

0 commit comments

Comments
 (0)