Change:
<details<summary<strongBacktrace</strong</summary<p</p</details
Changing Self{field} to MyStruct{field} makes it build btw.
I haven't done a search for the exact commit, but on the playground this regressed between beta and nightly. label +regression-from-stable-to-nightly
This is due to the NLL stabilization PR , since it manifests with on 1.61 (with to allow feature flags). I'll be looking at it in a few hours when I get home!

Discussion:
| RegionNameSource::AnonRegionFromUpvar(..) | RegionNameSource::AnonRegionFromOutput(..) | RegionNameSource::AnonRegionFromYieldTy(..) <del> | RegionNameSource::AnonRegionFromAsyncFn(..) => { </del> <ins> | RegionNameSource::AnonRegionFromAsyncFn(..) | RegionNameSource::AnonRegionFromImplSignature(..) => { </ins> debug!("Region {:?} is NOT suggestable", name); false }

use rustc_hir::def::{DefKind, Res}; use rustc_middle::ty::print::RegionHighlightMode; use rustc_middle::ty::subst::{GenericArgKind, SubstsRef}; <del> use rustc_middle::ty::{self, RegionVid, Ty}; </del> <ins> use rustc_middle::ty::{self, DefIdTree, RegionVid, Ty}; </ins> use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{Span, DUMMY_SP};

AnonRegionFromYieldTy(Span, String), /// An anonymous region from an async fn. AnonRegionFromAsyncFn(Span), <ins> /// An anonymous region from an impl self type or trait AnonRegionFromImplSignature(Span, &'static str), </ins> } /// Describes what to highlight to explain to the user that we're giving an anonymous region a

| RegionNameSource::AnonRegionFromUpvar(..) | RegionNameSource::AnonRegionFromOutput(..) | RegionNameSource::AnonRegionFromYieldTy(..) <del> | RegionNameSource::AnonRegionFromAsyncFn(..) => false, </del> <ins> | RegionNameSource::AnonRegionFromAsyncFn(..) | RegionNameSource::AnonRegionFromImplSignature(..) => false, </ins> } }

| RegionNameSource::SynthesizedFreeEnvRegion(span, _) | RegionNameSource::AnonRegionFromUpvar(span, _) | RegionNameSource::AnonRegionFromYieldTy(span, _) <del> | RegionNameSource::AnonRegionFromAsyncFn(span) => Some(span), </del> <ins> | RegionNameSource::AnonRegionFromAsyncFn(span) | RegionNameSource::AnonRegionFromImplSignature(span, _) => Some(span), </ins> RegionNameSource::AnonRegionFromArgument(ref highlight) | RegionNameSource::AnonRegionFromOutput(ref highlight, _) => match *highlight { RegionNameHighlight::MatchedHirTy(span)

RegionNameSource::AnonRegionFromYieldTy(span, type_name) => { diag.span_label(*span, format!("yield type is {type_name}")); } <ins> RegionNameSource::AnonRegionFromImplSignature(span, location) => { diag.span_label( *span, format!("lifetime `{self}` appears in the `impl`'s {location}"), ); } </ins> RegionNameSource::Static => {} } }

.or_else(|| self.give_name_if_anonymous_region_appears_in_arguments(fr)) .or_else(|| self.give_name_if_anonymous_region_appears_in_upvars(fr)) .or_else(|| self.give_name_if_anonymous_region_appears_in_output(fr)) <del> .or_else(|| self.give_name_if_anonymous_region_appears_in_yield_ty(fr)); </del> <ins> .or_else(|| self.give_name_if_anonymous_region_appears_in_yield_ty(fr)) .or_else(|| self.give_name_if_anonymous_region_appears_in_impl_signature(fr)); </ins> if let Some(ref value) = value { self.region_names.try_borrow_mut().unwrap().insert(fr, value.clone());

source: RegionNameSource::AnonRegionFromYieldTy(yield_span, type_name), }) } <ins> fn give_name_if_anonymous_region_appears_in_impl_signature( &self, fr: RegionVid, ) -> Option<RegionName> { let ty::ReEarlyBound(region) = *self.to_error_region(fr)? else { return None; }; if region.has_name() { return None; }; let tcx = self.infcx.tcx; let body_parent_did = tcx.opt_parent(self.mir_def_id().to_def_id())?; if tcx.parent(region.def_id) != body_parent_did || tcx.def_kind(body_parent_did) != DefKind::Impl { return None; } let mut found = false; tcx.fold_regions(tcx.type_of(body_parent_did), &mut true, |r: ty::Region<'tcx>, _| { if *r == ty::ReEarlyBound(region) { found = true; } r }); Some(RegionName { name: self.synthesize_region_name(), source: RegionNameSource::AnonRegionFromImplSignature( tcx.def_span(region.def_id), // FIXME(compiler-errors): Does this ever actually show up // anywhere other than the self type? I couldn't create an // example of a `'_` in the impl's trait being referenceable. if found { "self type" } else { "header" }, ), }) } </ins> }

<ins> pub struct MyStruct<'a> { field: &'a [u32], } impl MyStruct<'_> { pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> { Self { field } //~^ ERROR lifetime may not live long enough //~| ERROR lifetime may not live long enough } } trait Trait<'a> { fn new(field: &'a [u32]) -> MyStruct<'a>; } impl<'a> Trait<'a> for MyStruct<'_> { fn new(field: &'a [u32]) -> MyStruct<'a> { Self { field } //~^ ERROR lifetime may not live long enough //~| ERROR lifetime may not live long enough } } fn main() {} </ins>

<ins> error: lifetime may not live long enough --> $DIR/issue-98170.rs:7:9 | LL | impl MyStruct<'_> { |               -- lifetime `'1` appears in the `impl`'s self type LL |     pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> { |                -- lifetime `'a` defined here LL |         Self { field } |         ^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` error: lifetime may not live long enough --> $DIR/issue-98170.rs:7:16 | LL | impl MyStruct<'_> { |               -- lifetime `'1` appears in the `impl`'s self type LL |     pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> { |                -- lifetime `'a` defined here LL |         Self { field } |                ^^^^^ this usage requires that `'a` must outlive `'1` error: lifetime may not live long enough --> $DIR/issue-98170.rs:19:9 | LL | impl<'a> Trait<'a> for MyStruct<'_> { |      --                         -- lifetime `'1` appears in the `impl`'s self type |      | |      lifetime `'a` defined here LL |     fn new(field: &'a [u32]) -> MyStruct<'a> { LL |         Self { field } |         ^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` error: lifetime may not live long enough --> $DIR/issue-98170.rs:19:16 | LL | impl<'a> Trait<'a> for MyStruct<'_> { |      --                         -- lifetime `'1` appears in the `impl`'s self type |      | |      lifetime `'a` defined here LL |     fn new(field: &'a [u32]) -> MyStruct<'a> { LL |         Self { field } |                ^^^^^ this usage requires that `'a` must outlive `'1` error: aborting due to 4 previous errors </ins>