Skip to content

Commit 5e2fbc1

Browse files
Simplify some lifetimes
1 parent 192ad03 commit 5e2fbc1

File tree

28 files changed

+85
-98
lines changed

28 files changed

+85
-98
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,9 +2096,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20962096
self.new_named_lifetime_with_res(new_id, ident, res)
20972097
}
20982098

2099-
fn lower_generic_params_mut<'s>(
2100-
&'s mut self,
2101-
params: &'s [GenericParam],
2099+
fn lower_generic_params_mut(
2100+
&mut self,
2101+
params: &[GenericParam],
21022102
source: hir::GenericParamSource,
21032103
) -> impl Iterator<Item = hir::GenericParam<'hir>> {
21042104
params.iter().map(move |param| self.lower_generic_param(param, source))
@@ -2260,9 +2260,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22602260
self.arena.alloc_from_iter(self.lower_param_bounds_mut(bounds, itctx))
22612261
}
22622262

2263-
fn lower_param_bounds_mut<'s>(
2264-
&'s mut self,
2265-
bounds: &'s [GenericBound],
2263+
fn lower_param_bounds_mut(
2264+
&mut self,
2265+
bounds: &[GenericBound],
22662266
itctx: ImplTraitContext,
22672267
) -> impl Iterator<Item = hir::GenericBound<'hir>> {
22682268
bounds.iter().map(move |bound| self.lower_param_bound(bound, itctx))

compiler/rustc_attr/src/builtin.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,23 +1163,23 @@ pub fn find_transparency(
11631163
(transparency.map_or(fallback, |t| t.0), error)
11641164
}
11651165

1166-
pub fn allow_internal_unstable<'a>(
1167-
sess: &'a Session,
1168-
attrs: &'a [Attribute],
1166+
pub fn allow_internal_unstable(
1167+
sess: &Session,
1168+
attrs: &[Attribute],
11691169
) -> impl Iterator<Item = Symbol> {
11701170
allow_unstable(sess, attrs, sym::allow_internal_unstable)
11711171
}
11721172

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

1180-
fn allow_unstable<'a>(
1181-
sess: &'a Session,
1182-
attrs: &'a [Attribute],
1180+
fn allow_unstable(
1181+
sess: &Session,
1182+
attrs: &[Attribute],
11831183
symbol: Symbol,
11841184
) -> impl Iterator<Item = Symbol> {
11851185
let attrs = attr::filter_by_name(attrs, symbol);

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,8 +3540,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
35403540
location: Location,
35413541
mpi: MovePathIndex,
35423542
) -> (Vec<MoveSite>, Vec<Location>) {
3543-
fn predecessor_locations<'tcx, 'a>(
3544-
body: &'a mir::Body<'tcx>,
3543+
fn predecessor_locations<'tcx>(
3544+
body: &mir::Body<'tcx>,
35453545
location: Location,
35463546
) -> impl Iterator<Item = Location> {
35473547
if location.statement_index == 0 {

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
602602
self.scc_values.region_value_str(scc)
603603
}
604604

605-
pub(crate) fn placeholders_contained_in<'a>(
606-
&'a self,
605+
pub(crate) fn placeholders_contained_in(
606+
&self,
607607
r: RegionVid,
608608
) -> impl Iterator<Item = ty::PlaceholderRegion> {
609609
let scc = self.constraint_sccs.scc(r);

compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ pub(crate) struct ReverseSccGraph {
2020

2121
impl ReverseSccGraph {
2222
/// Find all universal regions that are required to outlive the given SCC.
23-
pub(super) fn upper_bounds<'a>(
24-
&'a self,
25-
scc0: ConstraintSccIndex,
26-
) -> impl Iterator<Item = RegionVid> {
23+
pub(super) fn upper_bounds(&self, scc0: ConstraintSccIndex) -> impl Iterator<Item = RegionVid> {
2724
let mut duplicates = FxIndexSet::default();
2825
graph::depth_first_search(&self.graph, scc0)
2926
.flat_map(move |scc1| {

compiler/rustc_borrowck/src/region_infer/values.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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> {
365+
pub(crate) fn locations_outlived_by(&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))
@@ -371,16 +371,13 @@ impl<N: Idx> RegionValues<N> {
371371
}
372372

373373
/// Returns just the universal regions that are contained in a given region's value.
374-
pub(crate) fn universal_regions_outlived_by<'a>(
375-
&'a self,
376-
r: N,
377-
) -> impl Iterator<Item = RegionVid> {
374+
pub(crate) fn universal_regions_outlived_by(&self, r: N) -> impl Iterator<Item = RegionVid> {
378375
self.free_regions.row(r).into_iter().flat_map(|set| set.iter())
379376
}
380377

381378
/// Returns all the elements contained in a given region's value.
382-
pub(crate) fn placeholders_contained_in<'a>(
383-
&'a self,
379+
pub(crate) fn placeholders_contained_in(
380+
&self,
384381
r: N,
385382
) -> impl Iterator<Item = ty::PlaceholderRegion> {
386383
self.placeholders
@@ -391,7 +388,7 @@ impl<N: Idx> RegionValues<N> {
391388
}
392389

393390
/// Returns all the elements contained in a given region's value.
394-
pub(crate) fn elements_contained_in<'a>(&'a self, r: N) -> impl Iterator<Item = RegionElement> {
391+
pub(crate) fn elements_contained_in(&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/universal_regions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ impl<'tcx> UniversalRegions<'tcx> {
334334
}
335335

336336
/// Gets an iterator over all the early-bound regions that have names.
337-
pub fn named_universal_regions<'s>(
338-
&'s self,
337+
pub fn named_universal_regions(
338+
&self,
339339
) -> impl Iterator<Item = (ty::Region<'tcx>, ty::RegionVid)> {
340340
self.indices.indices.iter().map(|(&r, &v)| (r, v))
341341
}

compiler/rustc_hir_analysis/src/collect.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,10 +1764,10 @@ fn polarity_of_impl(
17641764
/// the lifetimes that are declared. For fns or methods, we have to
17651765
/// screen out those that do not appear in any where-clauses etc using
17661766
/// `resolve_lifetime::early_bound_lifetimes`.
1767-
fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>(
1767+
fn early_bound_lifetimes_from_generics<'a, 'tcx>(
17681768
tcx: TyCtxt<'tcx>,
1769-
generics: &'a hir::Generics<'a>,
1770-
) -> impl Iterator<Item = &'a hir::GenericParam<'a>> {
1769+
generics: &'a hir::Generics<'tcx>,
1770+
) -> impl Iterator<Item = &'a hir::GenericParam<'tcx>> {
17711771
generics.params.iter().filter(move |param| match param.kind {
17721772
GenericParamKind::Lifetime { .. } => !tcx.is_late_bound(param.hir_id),
17731773
_ => false,

compiler/rustc_infer/src/infer/canonical/query_response.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,12 @@ impl<'tcx> InferCtxt<'tcx> {
548548

549549
/// Converts the region constraints resulting from a query into an
550550
/// iterator of obligations.
551-
fn query_outlives_constraints_into_obligations<'a>(
552-
&'a self,
553-
cause: &'a ObligationCause<'tcx>,
551+
fn query_outlives_constraints_into_obligations(
552+
&self,
553+
cause: &ObligationCause<'tcx>,
554554
param_env: ty::ParamEnv<'tcx>,
555-
uninstantiated_region_constraints: &'a [QueryOutlivesConstraint<'tcx>],
556-
result_args: &'a CanonicalVarValues<'tcx>,
555+
uninstantiated_region_constraints: &[QueryOutlivesConstraint<'tcx>],
556+
result_args: &CanonicalVarValues<'tcx>,
557557
) -> impl Iterator<Item = PredicateObligation<'tcx>> {
558558
uninstantiated_region_constraints.iter().map(move |&constraint| {
559559
let predicate = instantiate_value(self.tcx, result_args, constraint);

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,9 +1473,7 @@ impl<'tcx> InferCtxt<'tcx> {
14731473
/// The returned function is used in a fast path. If it returns `true` the variable is
14741474
/// unchanged, `false` indicates that the status is unknown.
14751475
#[inline]
1476-
pub fn is_ty_infer_var_definitely_unchanged<'a>(
1477-
&'a self,
1478-
) -> impl Fn(TyOrConstInferVar) -> bool {
1476+
pub fn is_ty_infer_var_definitely_unchanged(&self) -> impl Fn(TyOrConstInferVar) -> bool {
14791477
// This hoists the borrow/release out of the loop body.
14801478
let inner = self.inner.try_borrow();
14811479

0 commit comments

Comments
 (0)