Change:
(A better title would be appreciated) I like this part: It could have a suggestion like , especially because are very close to each other on a US keyboard and could very well be a typo. Applying the suggestion will result in a compile error. No response No response <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
I think the label might be fitting as well.
Error: Parsing assign command in failed: ...' claim' ' +D-invali'... Please file an issue on GitHub at if there's a problem with this bot, or reach out on on Zulip.

Discussion:
return (err, Vec::new()); } <del> let (found, candidates) = self.try_lookup_name_relaxed( </del> <ins> let (found, mut candidates) = self.try_lookup_name_relaxed( </ins> &mut err, source, path,

return (err, candidates); } <del> let mut fallback = self.suggest_trait_and_bounds(&mut err, source, res, span, &base_error); </del> <ins> if self.suggest_shadowed(&mut err, source, path, following_seg, span) { // if there is already a shadowed name, don'suggest candidates for importing candidates.clear(); } </ins> <del> // if we have suggested using pattern matching, then don't add needless suggestions // for typos. </del> <ins> let mut fallback = self.suggest_trait_and_bounds(&mut err, source, res, span, &base_error); </ins> fallback |= self.suggest_typo(&mut err, source, path, following_seg, span, &base_error); if fallback {

let ident_span = path.last().map_or(span, |ident| ident.ident.span); let typo_sugg = self.lookup_typo_candidate(path, following_seg, source.namespace(), is_expected); <del> let is_in_same_file = &|sp1, sp2| { let source_map = self.r.tcx.sess.source_map(); let file1 = source_map.span_to_filename(sp1); let file2 = source_map.span_to_filename(sp2); file1 == file2 }; // print 'you might have meant' if the candidate is (1) is a shadowed name with // accessible definition and (2) either defined in the same crate as the typo // (could be in a different file) or introduced in the same file as the typo // (could belong to a different crate) if let TypoCandidate::Shadowed(res, Some(sugg_span)) = typo_sugg && res.opt_def_id().is_some_and(|id| id.is_local() || is_in_same_file(span, sugg_span)) { err.span_label( sugg_span, format!("you might have meant to refer to this {}", res.descr()), ); return true; } </del> let mut fallback = false; let typo_sugg = typo_sugg.to_opt_suggestion(); if !self.r.add_typo_suggestion(err, typo_sugg, ident_span) {

fallback } <ins> fn suggest_shadowed( &mut self, err: &mut Diagnostic, source: PathSource<'_>, path: &[Segment], following_seg: Option<&Segment>, span: Span, ) -> bool { let is_expected = &|res| source.is_expected(res); let typo_sugg = self.lookup_typo_candidate(path, following_seg, source.namespace(), is_expected); let is_in_same_file = &|sp1, sp2| { let source_map = self.r.tcx.sess.source_map(); let file1 = source_map.span_to_filename(sp1); let file2 = source_map.span_to_filename(sp2); file1 == file2 }; // print 'you might have meant' if the candidate is (1) is a shadowed name with // accessible definition and (2) either defined in the same crate as the typo // (could be in a different file) or introduced in the same file as the typo // (could belong to a different crate) if let TypoCandidate::Shadowed(res, Some(sugg_span)) = typo_sugg && res.opt_def_id().is_some_and(|id| id.is_local() || is_in_same_file(span, sugg_span)) { err.span_label( sugg_span, format!("you might have meant to refer to this {}", res.descr()), ); return true; } false } </ins> fn err_code_special_cases( &mut self, err: &mut Diagnostic,

<ins> use std::io::Read; fn f<T: Read, U, Read>() {} //~ ERROR expected trait, found type parameter `Read` fn main() {} </ins>

<ins> error[E0404]: expected trait, found type parameter `Read` --> $DIR/issue-120559.rs:3:9 | LL | use std::io::Read; |              ---- you might have meant to refer to this trait LL | LL | fn f<T: Read, U, Read>() {} |         ^^^^     ---- found this type parameter |         | |         not a trait error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0404`. </ins>

|                ---  ^^^ not a trait |                | |                found this type parameter <del> | help: consider importing this trait instead | LL + use std::ops::Add; | </del> error: aborting due to 1 previous error