Skip to content

Commit f7c859b

Browse files
Remove unncessary outlives and captures from RPITs
1 parent ac1d067 commit f7c859b

File tree

89 files changed

+160
-207
lines changed

Some content is hidden

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

89 files changed

+160
-207
lines changed

compiler/rustc_abi/src/lib.rs

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

12981298
/// Gets source indices of the fields by increasing offsets.
12991299
#[inline]
1300-
pub fn index_by_increasing_offset(&self) -> impl ExactSizeIterator<Item = usize> + '_ {
1300+
pub fn index_by_increasing_offset(&self) -> impl ExactSizeIterator<Item = usize> {
13011301
let mut inverse_small = [0u8; 64];
13021302
let mut inverse_big = IndexVec::new();
13031303
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 std::collections::hash_map::Entry;
4545
use rustc_ast::node_id::NodeMap;
4646
use rustc_ast::ptr::P;
4747
use rustc_ast::{self as ast, *};
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;
@@ -2078,7 +2077,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20782077
&'s mut self,
20792078
params: &'s [GenericParam],
20802079
source: hir::GenericParamSource,
2081-
) -> impl Iterator<Item = hir::GenericParam<'hir>> + Captures<'a> + Captures<'s> {
2080+
) -> impl Iterator<Item = hir::GenericParam<'hir>> {
20822081
params.iter().map(move |param| self.lower_generic_param(param, source))
20832082
}
20842083

@@ -2242,7 +2241,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22422241
&'s mut self,
22432242
bounds: &'s [GenericBound],
22442243
itctx: ImplTraitContext,
2245-
) -> impl Iterator<Item = hir::GenericBound<'hir>> + Captures<'s> + Captures<'a> {
2244+
) -> impl Iterator<Item = hir::GenericBound<'hir>> {
22462245
bounds.iter().map(move |bound| self.lower_param_bound(bound, itctx))
22472246
}
22482247

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
@@ -160,7 +160,7 @@ impl<'tcx> BorrowSet<'tcx> {
160160
self.location_map.len()
161161
}
162162

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

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};
@@ -3556,7 +3555,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
35563555
fn predecessor_locations<'a, 'tcx>(
35573556
body: &'a mir::Body<'tcx>,
35583557
location: Location,
3559-
) -> impl Iterator<Item = Location> + Captures<'tcx> + 'a {
3558+
) -> impl Iterator<Item = Location> {
35603559
if location.statement_index == 0 {
35613560
let predecessors = body.basic_blocks.predecessors()[location.block].to_vec();
35623561
Either::Left(predecessors.into_iter().map(move |bb| body.terminator_loc(bb)))

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;
@@ -151,9 +150,7 @@ impl<'tcx, R> MemberConstraintSet<'tcx, R>
151150
where
152151
R: Copy + Hash + Eq,
153152
{
154-
pub(crate) fn all_indices(
155-
&self,
156-
) -> impl Iterator<Item = NllMemberConstraintIndex> + Captures<'tcx> + '_ {
153+
pub(crate) fn all_indices(&self) -> impl Iterator<Item = NllMemberConstraintIndex> {
157154
self.constraints.indices()
158155
}
159156

@@ -163,7 +160,7 @@ where
163160
pub(crate) fn indices(
164161
&self,
165162
member_region_vid: R,
166-
) -> impl Iterator<Item = NllMemberConstraintIndex> + Captures<'tcx> + '_ {
163+
) -> impl Iterator<Item = NllMemberConstraintIndex> {
167164
let mut next = self.first_constraints.get(&member_region_vid).cloned();
168165
std::iter::from_fn(move || -> Option<NllMemberConstraintIndex> {
169166
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
@@ -553,7 +553,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
553553
}
554554

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

@@ -566,7 +566,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
566566
}
567567

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

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

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
@@ -100,15 +100,15 @@ impl LivenessValues {
100100
}
101101

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

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

@@ -173,7 +173,7 @@ impl LivenessValues {
173173
}
174174

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

361361
/// Returns the locations contained within a given region `r`.
362-
pub(crate) fn locations_outlived_by<'a>(&'a self, r: N) -> impl Iterator<Item = Location> + 'a {
362+
pub(crate) fn locations_outlived_by<'a>(&'a self, r: N) -> impl Iterator<Item = Location> {
363363
self.points.row(r).into_iter().flat_map(move |set| {
364364
set.iter()
365365
.take_while(move |&p| self.elements.point_in_range(p))
@@ -371,15 +371,15 @@ impl<N: Idx> RegionValues<N> {
371371
pub(crate) fn universal_regions_outlived_by<'a>(
372372
&'a self,
373373
r: N,
374-
) -> impl Iterator<Item = RegionVid> + 'a {
374+
) -> impl Iterator<Item = RegionVid> {
375375
self.free_regions.row(r).into_iter().flat_map(|set| set.iter())
376376
}
377377

378378
/// Returns all the elements contained in a given region's value.
379379
pub(crate) fn placeholders_contained_in<'a>(
380380
&'a self,
381381
r: N,
382-
) -> impl Iterator<Item = ty::PlaceholderRegion> + 'a {
382+
) -> impl Iterator<Item = ty::PlaceholderRegion> {
383383
self.placeholders
384384
.row(r)
385385
.into_iter()
@@ -388,10 +388,7 @@ impl<N: Idx> RegionValues<N> {
388388
}
389389

390390
/// Returns all the elements contained in a given region's value.
391-
pub(crate) fn elements_contained_in<'a>(
392-
&'a self,
393-
r: N,
394-
) -> impl Iterator<Item = RegionElement> + 'a {
391+
pub(crate) fn elements_contained_in<'a>(&'a self, r: N) -> impl Iterator<Item = RegionElement> {
395392
let points_iter = self.locations_outlived_by(r).map(RegionElement::Location);
396393

397394
let free_regions_iter =

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl UniversalRegionRelations<'_> {
176176
}
177177

178178
/// Returns the _non-transitive_ set of known `outlives` constraints between free regions.
179-
pub(crate) fn known_outlives(&self) -> impl Iterator<Item = (RegionVid, RegionVid)> + '_ {
179+
pub(crate) fn known_outlives(&self) -> impl Iterator<Item = (RegionVid, RegionVid)> {
180180
self.outlives.base_edges()
181181
}
182182
}

0 commit comments

Comments
 (0)