diff options
| author | Philipp Hansch <dev@phansch.net> | 2019-09-01 12:15:33 +0200 |
|---|---|---|
| committer | Philipp Hansch <dev@phansch.net> | 2019-09-01 13:05:47 +0200 |
| commit | 84ccbe2076cf37bc13c32a89ccc57a57281b8708 (patch) | |
| tree | 4ea1758f9ea16991df236fe32efdc15f355fe540 /src/librustc_errors/annotate_snippet_emitter_writer.rs | |
| parent | 2d851b33181b1404856cb1d8b20d261adda54ffb (diff) | |
| download | rust-84ccbe2076cf37bc13c32a89ccc57a57281b8708.tar.gz rust-84ccbe2076cf37bc13c32a89ccc57a57281b8708.zip | |
librustc_errors: Extract sugg/subst handling into method
An initial refactoring before working on #61809. This moves the whole block into a method so that it can be reused in the annotate-snippet output. It's already used in the new emitter, but there's no UI tests with suggestions included in this PR. A first look at some UI tests with suggestions showed that there's some more work to do in [annotate-snippet-rs][annotate-snippet-rs] before the new output is closer to the current one.
Diffstat (limited to 'src/librustc_errors/annotate_snippet_emitter_writer.rs')
| -rw-r--r-- | src/librustc_errors/annotate_snippet_emitter_writer.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/librustc_errors/annotate_snippet_emitter_writer.rs b/src/librustc_errors/annotate_snippet_emitter_writer.rs index 255af3122e7..3bed5d81dc5 100644 --- a/src/librustc_errors/annotate_snippet_emitter_writer.rs +++ b/src/librustc_errors/annotate_snippet_emitter_writer.rs @@ -30,10 +30,8 @@ pub struct AnnotateSnippetEmitterWriter { impl Emitter for AnnotateSnippetEmitterWriter { /// The entry point for the diagnostics generation fn emit_diagnostic(&mut self, db: &DiagnosticBuilder<'_>) { - let primary_span = db.span.clone(); let children = db.children.clone(); - // FIXME(#59346): Collect suggestions (see emitter.rs) - let suggestions: &[_] = &[]; + let (primary_span, suggestions) = self.primary_span_formatted(&db); // FIXME(#59346): Add `fix_multispans_in_std_macros` function from emitter.rs |
