Change:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --I tried this code: () I expected to see this happen (which works correctly with rustc 1.57.0 stable): But with , I get: <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: </p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
Also consider the following code, which creates an error message that could be more precise. I wouldn't call the following example a bug, but maybe these two issues are related: () Error output:
I think this is due to cc: let me see if I can fix this real quick.
claim
label +regression-from-stable-to-nightly +A-diagnostics
Error: Label P-low can only be set by Rust team members Please let know if you're having trouble with this bot.
Assigning priority as discussed in the of the Prioritization Working Group. label -I-prioritize +P-medium

Discussion:
// See rustc_resolve::late::lifetimes::LifetimeContext::add_missing_lifetime_specifiers_label let elided_lifetime_span = if generic_args.span.is_empty() { // If there are no brackets, use the identifier span. <del> path_span </del> <ins> // HACK: we use find_ancestor_inside to properly suggest elided spans in paths // originating from macros, since the segment's span might be from a macro arg. segment.ident.span.find_ancestor_inside(path_span).unwrap_or(path_span) </ins> } else if generic_args.is_empty() { // If there are brackets, but not generic arguments, then use the opening bracket generic_args.span.with_hi(generic_args.span.lo() + BytePos(1))

let spans_suggs: Vec<_> = formatters .into_iter() .zip(spans_with_counts.iter()) <del> .filter_map(|(fmt, (span, _))| { if let Some(formatter) = fmt { Some((formatter, span)) } else { None } </del> <ins> .filter_map(|(formatter, (span, _))| { if let Some(formatter) = formatter { Some((*span, formatter(name))) } else { None } </ins> }) <del> .map(|(formatter, span)| (*span, formatter(name))) </del> .collect(); if spans_suggs.is_empty() { // If all the spans come from macros, we cannot extract snippets and then

<ins> #![feature(generic_associated_types)] #![allow(unused)] trait Trait<'a> { type Foo; type Bar<'b> //~^ NOTE associated type defined here, with 1 lifetime parameter //~| NOTE where Self: 'b; } struct Impl<'a>(&'a ()); impl<'a> Trait<'a> for Impl<'a> { type Foo = &'a (); type Bar<'b> = &'b (); } type A<'a> = Impl<'a>; type B<'a> = <A<'a> as Trait>::Foo; //~^ ERROR missing lifetime specifier //~| NOTE expected named lifetime parameter type C<'a, 'b> = <A<'a> as Trait>::Bar; //~^ ERROR missing lifetime specifier //~| ERROR missing generics for associated type //~| NOTE expected named lifetime parameter //~| NOTE these named lifetimes are available to use //~| NOTE expected 1 lifetime argument fn main() {} </ins>

<ins> error[E0106]: missing lifetime specifier --> $DIR/missing-lifetime-in-alias.rs:23:24 | LL | type B<'a> = <A<'a> as Trait>::Foo; |                        ^^^^^ expected named lifetime parameter | help: consider using the `'a` lifetime | LL | type B<'a> = <A<'a> as Trait<'a>>::Foo; |                        ~~~~~~~~~ error[E0106]: missing lifetime specifier --> $DIR/missing-lifetime-in-alias.rs:27:28 | LL | type C<'a, 'b> = <A<'a> as Trait>::Bar; |                            ^^^^^ expected named lifetime parameter | note: these named lifetimes are available to use --> $DIR/missing-lifetime-in-alias.rs:27:8 | LL | type C<'a, 'b> = <A<'a> as Trait>::Bar; |        ^^  ^^ error[E0107]: missing generics for associated type `Trait::Bar` --> $DIR/missing-lifetime-in-alias.rs:27:36 | LL | type C<'a, 'b> = <A<'a> as Trait>::Bar; |                                    ^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'b` --> $DIR/missing-lifetime-in-alias.rs:7:10 | LL |     type Bar<'b> |          ^^^ -- help: add missing lifetime argument | LL | type C<'a, 'b> = <A<'a> as Trait>::Bar<'a>; |                                    ~~~~~~~ error: aborting due to 3 previous errors Some errors have detailed explanations: E0106, E0107. For more information about an error, try `rustc --explain E0106`. </ins>

warning: hidden lifetime parameters in types are deprecated <del> --> $DIR/reasons.rs:20:29 </del> <ins> --> $DIR/reasons.rs:20:34 </ins> | LL |     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { <del> |                             ^^^^^^^^^^^^^^ expected named lifetime parameter </del> <ins> |                                  ^^^^^^^^^ expected named lifetime parameter </ins> | = note: explicit anonymous lifetimes aid reasoning about ownership note: the lint level is defined here

help: consider using the `'_` lifetime | LL |     fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { <del> |                             ~~~~~~~~~~~~~~~~~~ </del> <ins> |                                  ~~~~~~~~~~~~~ </ins> warning: variable `Social_exchange_psychology` should have a snake case name --> $DIR/reasons.rs:30:9