Change:
Compiler crashes with Also, I wonder what is the right way (or is there any way) to write a with expected behavior. Thanks.
Reduced:
Regression first occurred in 1.30 according to godbolt.
One can leave out the trait in your MCVE, still crashes. Bug was introduced somewhere between ... Sadly that's a very big range, but there are no nightlys available in between and also no bors artifacts because they are older than 167
triage: P-high
Smaller example from :
I was trying to remove as many type parameters as possible, and ended up with this: Removing after still cuases an ICE. Adding a after stops causing the ICE. Removing the also stops causing the ICE. Not sure if it's any more or less helpful, but just putting this here.
claim Looks like that didn't work, either way, I'm taking a look into this issue.
Error: The feature is not enabled in this repository. To enable it add its section in the in the root of the repository. Please let know if you're having trouble with this bot.
Error: The feature is not enabled in this repository. To enable it add its section in the in the root of the repository. Please let know if you're having trouble with this bot.

Discussion:
} // Prohibit explicit lifetime arguments if late-bound lifetime parameters are present. <ins> let mut reported_late_bound_region_err = None; </ins> if !infer_lifetimes { if let Some(span_late) = def.has_late_bound_regions { let msg = "cannot specify lifetime arguments explicitly 

let mut err = tcx.sess.struct_span_err(span, msg); err.span_note(span_late, note); err.emit(); <del> return (true, None); </del> <ins> reported_late_bound_region_err = Some(true); </ins> } else { let mut multispan = MultiSpan::from_span(span); multispan.push_span_label(span_late, note.to_string()); tcx.lint_hir(lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS, args.args[0].id(), multispan, msg); <del> return (false, None); </del> <ins> reported_late_bound_region_err = Some(false); </ins> } } }

// For kinds without defaults (i.e., lifetimes), `required == permitted`. // For other kinds (i.e., types), `permitted` may be greater than `required`. if required <= provided && provided <= permitted { <del> return (false, None); </del> <ins> return (reported_late_bound_region_err.unwrap_or(false), None); </ins> } // Unfortunately lifetime and type parameter mismatches are typically styled

potential_assoc_types) }; <del> if !infer_lifetimes || arg_counts.lifetimes > param_counts.lifetimes { </del> <ins> if reported_late_bound_region_err.is_none() && (!infer_lifetimes || arg_counts.lifetimes > param_counts.lifetimes) { </ins> check_kind_count( "lifetime", param_counts.lifetimes,

arg_counts.lifetimes, ) } else { <del> (false, None) </del> <ins> (reported_late_bound_region_err.unwrap_or(false), None) </ins> } }

<ins> // ignore-tidy-linelength #![deny(warnings)] struct Borked {} impl Borked { fn a(&self) {} } fn run_wild<T>(b: &Borked) { b.a::<'_, T>(); //~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present //~^^ ERROR wrong number of type arguments: expected 0, found 1 //~^^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! } fn main() {} </ins>

<ins> error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/issue-60622.rs:12:11 | LL |     fn a(&self) {} |          - the late bound lifetime parameter is introduced here ... LL |     b.a::<'_, T>(); |           ^^ | note: lint level defined here --> $DIR/issue-60622.rs:3:9 | LL | #![deny(warnings)] |         ^^^^^^^^ = note: #[deny(late_bound_lifetime_arguments)] implied by #[deny(warnings)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868> error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/issue-60622.rs:12:15 | LL |     b.a::<'_, T>(); |               ^ unexpected type argument error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0107`. </ins>