diff options
| author | bors <bors@rust-lang.org> | 2023-12-10 08:08:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-10 08:08:03 +0000 |
| commit | 92ab9d65bb8f3a1b167c2ccb9d22de301a7aef45 (patch) | |
| tree | 0a9542f67746bf7a90b8bb4881b56de39b138cb9 /compiler/rustc_errors | |
| parent | aa7afff8c619fc9c04515b7cef57d72dc3c7e51e (diff) | |
| parent | 035d86594ddcaec12b59c35f8de1a99c3b8b81fb (diff) | |
| download | rust-92ab9d65bb8f3a1b167c2ccb9d22de301a7aef45.tar.gz rust-92ab9d65bb8f3a1b167c2ccb9d22de301a7aef45.zip | |
Auto merge of #3217 - RalfJung:rustup, r=RalfJung
Rustup Pulls in https://github.com/rust-lang/rust/pull/117953 (in preparation for implementing those intrinsics)
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 6aaf4a0f5cf..4fb63d67e78 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -591,17 +591,18 @@ impl Diagnostic { pub fn multipart_suggestion_with_style( &mut self, msg: impl Into<SubdiagnosticMessage>, - suggestion: Vec<(Span, String)>, + mut suggestion: Vec<(Span, String)>, applicability: Applicability, style: SuggestionStyle, ) -> &mut Self { - let mut parts = suggestion + suggestion.sort_unstable(); + suggestion.dedup(); + + let parts = suggestion .into_iter() .map(|(span, snippet)| SubstitutionPart { snippet, span }) .collect::<Vec<_>>(); - parts.sort_unstable_by_key(|part| part.span); - assert!(!parts.is_empty()); debug_assert_eq!( parts.iter().find(|part| part.span.is_empty() && part.snippet.is_empty()), |
