Skip to content

Commit 0b3d6e8

Browse files
Simplify some lifetimes
1 parent d14a99f commit 0b3d6e8

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
@@ -2073,9 +2073,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20732073
self.new_named_lifetime_with_res(new_id, ident, res)
20742074
}
20752075

2076-
fn lower_generic_params_mut<'s>(
2077-
&'s mut self,
2078-
params: &'s [GenericParam],
2076+
fn lower_generic_params_mut(
2077+
&mut self,
2078+
params: &[GenericParam],
20792079
source: hir::GenericParamSource,
20802080
) -> impl Iterator<Item = hir::GenericParam<'hir>> {
20812081
params.iter().map(move |param| self.lower_generic_param(param, source))
@@ -2237,9 +2237,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22372237
self.arena.alloc_from_iter(self.lower_param_bounds_mut(bounds, itctx))
22382238
}
22392239

2240-
fn lower_param_bounds_mut<'s>(
2241-
&'s mut self,
2242-
bounds: &'s [GenericBound],
2240+
fn lower_param_bounds_mut(
2241+
&mut self,
2242+
bounds: &[GenericBound],
22432243
itctx: ImplTraitContext,
22442244
) -> impl Iterator<Item = hir::GenericBound<'hir>> {
22452245
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
@@ -3552,8 +3552,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
35523552
location: Location,
35533553
mpi: MovePathIndex,
35543554
) -> (Vec<MoveSite>, Vec<Location>) {
3555-
fn predecessor_locations<'a, 'tcx>(
3556-
body: &'a mir::Body<'tcx>,
3555+
fn predecessor_locations<'tcx>(
3556+
body: &mir::Body<'tcx>,
35573557
location: Location,
35583558
) -> impl Iterator<Item = Location> {
35593559
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
@@ -603,8 +603,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
603603
self.scc_values.region_value_str(scc)
604604
}
605605

606-
pub(crate) fn placeholders_contained_in<'a>(
607-
&'a self,
606+
pub(crate) fn placeholders_contained_in(
607+
&self,
608608
r: RegionVid,
609609
) -> impl Iterator<Item = ty::PlaceholderRegion> {
610610
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
@@ -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> {
362+
pub(crate) fn locations_outlived_by(&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))
@@ -368,16 +368,13 @@ impl<N: Idx> RegionValues<N> {
368368
}
369369

370370
/// Returns just the universal regions that are contained in a given region's value.
371-
pub(crate) fn universal_regions_outlived_by<'a>(
372-
&'a self,
373-
r: N,
374-
) -> impl Iterator<Item = RegionVid> {
371+
pub(crate) fn universal_regions_outlived_by(&self, r: N) -> impl Iterator<Item = RegionVid> {
375372
self.free_regions.row(r).into_iter().flat_map(|set| set.iter())
376373
}
377374

378375
/// Returns all the elements contained in a given region's value.
379-
pub(crate) fn placeholders_contained_in<'a>(
380-
&'a self,
376+
pub(crate) fn placeholders_contained_in(
377+
&self,
381378
r: N,
382379
) -> impl Iterator<Item = ty::PlaceholderRegion> {
383380
self.placeholders
@@ -388,7 +385,7 @@ impl<N: Idx> RegionValues<N> {
388385
}
389386

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

394391
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
@@ -336,8 +336,8 @@ impl<'tcx> UniversalRegions<'tcx> {
336336
}
337337

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

compiler/rustc_hir_analysis/src/collect.rs

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

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

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

550550
/// Converts the region constraints resulting from a query into an
551551
/// iterator of obligations.
552-
fn query_outlives_constraints_into_obligations<'a>(
553-
&'a self,
554-
cause: &'a ObligationCause<'tcx>,
552+
fn query_outlives_constraints_into_obligations(
553+
&self,
554+
cause: &ObligationCause<'tcx>,
555555
param_env: ty::ParamEnv<'tcx>,
556-
uninstantiated_region_constraints: &'a [QueryOutlivesConstraint<'tcx>],
557-
result_args: &'a CanonicalVarValues<'tcx>,
556+
uninstantiated_region_constraints: &[QueryOutlivesConstraint<'tcx>],
557+
result_args: &CanonicalVarValues<'tcx>,
558558
) -> impl Iterator<Item = PredicateObligation<'tcx>> {
559559
uninstantiated_region_constraints.iter().map(move |&constraint| {
560560
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
@@ -1474,9 +1474,7 @@ impl<'tcx> InferCtxt<'tcx> {
14741474
/// The returned function is used in a fast path. If it returns `true` the variable is
14751475
/// unchanged, `false` indicates that the status is unknown.
14761476
#[inline]
1477-
pub fn is_ty_infer_var_definitely_unchanged<'a>(
1478-
&'a self,
1479-
) -> impl Fn(TyOrConstInferVar) -> bool {
1477+
pub fn is_ty_infer_var_definitely_unchanged(&self) -> impl Fn(TyOrConstInferVar) -> bool {
14801478
// This hoists the borrow/release out of the loop body.
14811479
let inner = self.inner.try_borrow();
14821480

0 commit comments

Comments
 (0)