diff options
| author | Eduard-Mihai Burtescu <eddyb@lyken.rs> | 2022-01-24 09:19:33 +0000 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <eddyb@lyken.rs> | 2022-01-24 10:49:10 +0000 |
| commit | 68fa81baa3acf3a93ce4b41c8366039229926fc2 (patch) | |
| tree | c5df38fb546f41c444df071d4c0fb15927e46410 /compiler/rustc_errors/src/emitter.rs | |
| parent | 42313dd29b3edb0ab453a0d43d12876ec7e48ce0 (diff) | |
| download | rust-68fa81baa3acf3a93ce4b41c8366039229926fc2.tar.gz rust-68fa81baa3acf3a93ce4b41c8366039229926fc2.zip | |
rustc_errors: remove `allow_suggestions` from `DiagnosticBuilder`.
Diffstat (limited to 'compiler/rustc_errors/src/emitter.rs')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 3104bc185e7..f90f4d46a9a 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -227,7 +227,8 @@ pub trait Emitter { diag: &'a Diagnostic, ) -> (MultiSpan, &'a [CodeSuggestion]) { let mut primary_span = diag.span.clone(); - if let Some((sugg, rest)) = diag.suggestions.split_first() { + let suggestions = diag.suggestions.as_ref().map_or(&[][..], |suggestions| &suggestions[..]); + if let Some((sugg, rest)) = suggestions.split_first() { if rest.is_empty() && // ^ if there is only one suggestion // don't display multi-suggestions as labels @@ -282,10 +283,10 @@ pub trait Emitter { // to be consistent. We could try to figure out if we can // make one (or the first one) inline, but that would give // undue importance to a semi-random suggestion - (primary_span, &diag.suggestions) + (primary_span, suggestions) } } else { - (primary_span, &diag.suggestions) + (primary_span, suggestions) } } |
