1
Fork 0

Auto merge of #89427 - estebank:collect-overlapping-impls, r=jackh726

Point at overlapping impls when type annotations are needed

Address https://github.com/rust-lang/rust/issues/89254.
This commit is contained in:
bors 2021-10-24 22:26:41 +00:00
commit 41d8c94d45
38 changed files with 666 additions and 121 deletions

View file

@ -465,10 +465,14 @@ impl Diagnostic {
suggestions: impl Iterator<Item = String>,
applicability: Applicability,
) -> &mut Self {
let mut suggestions: Vec<_> = suggestions.collect();
suggestions.sort();
let substitutions = suggestions
.into_iter()
.map(|snippet| Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] })
.collect();
self.suggestions.push(CodeSuggestion {
substitutions: suggestions
.map(|snippet| Substitution { parts: vec![SubstitutionPart { snippet, span: sp }] })
.collect(),
substitutions,
msg: msg.to_owned(),
style: SuggestionStyle::ShowCode,
applicability,