Skip to content

Commit 34426ff

Browse files
committed
Avoid explicit trait object lifetimes
Stylistic-only. Increases legibility. Use explicitly elided lifetimes in impl headers, they get elaborated to fresh lifetime. Make use of object lifetime defaulting for a trait object type inside a reference type.
1 parent 323c283 commit 34426ff

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use rustc_span::symbol::{sym, Ident};
2222
use rustc_span::{Span, Symbol, DUMMY_SP};
2323
use rustc_trait_selection::traits::object_safety_violations_for_assoc_item;
2424

25-
impl<'o, 'tcx> dyn HirTyLowerer<'tcx> + 'o {
25+
impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2626
/// On missing type parameters, emit an E0393 error and provide a structured suggestion using
2727
/// the type parameter's name as a placeholder.
2828
pub(crate) fn complain_about_missing_type_params(

compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_trait_selection::traits::error_reporting::suggestions::NextTypeParamNa
88

99
use super::HirTyLowerer;
1010

11-
impl<'o, 'tcx> dyn HirTyLowerer<'tcx> + 'o {
11+
impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
1212
/// Make sure that we are in the condition to suggest the blanket implementation.
1313
pub(super) fn maybe_lint_blanket_trait_impl<G: EmissionGuarantee>(
1414
&self,

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub trait GenericArgsLowerer<'a, 'tcx> {
241241
) -> ty::GenericArg<'tcx>;
242242
}
243243

244-
impl<'o, 'tcx> dyn HirTyLowerer<'tcx> + 'o {
244+
impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
245245
/// Lower a lifetime from the HIR to our internal notion of a lifetime called a *region*.
246246
#[instrument(level = "debug", skip(self), ret)]
247247
pub fn lower_lifetime(
@@ -413,7 +413,7 @@ impl<'o, 'tcx> dyn HirTyLowerer<'tcx> + 'o {
413413
}
414414

415415
struct GenericArgsCtxt<'a, 'tcx> {
416-
lowerer: &'a (dyn HirTyLowerer<'tcx> + 'a),
416+
lowerer: &'a dyn HirTyLowerer<'tcx>,
417417
def_id: DefId,
418418
generic_args: &'a GenericArgs<'tcx>,
419419
span: Span,

compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use smallvec::{smallvec, SmallVec};
1717

1818
use super::HirTyLowerer;
1919

20-
impl<'o, 'tcx> dyn HirTyLowerer<'tcx> + 'o {
20+
impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2121
/// Lower a trait object type from the HIR to our internal notion of a type.
2222
#[instrument(level = "debug", skip_all, ret)]
2323
pub(super) fn lower_trait_object_ty(

0 commit comments

Comments
 (0)