about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-10-23 22:20:58 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-10-24 12:26:01 -0700
commit0baf61bfdb95980c69fbfcc0fc95ce82e8d81ac9 (patch)
tree83a1e3a9b3ce6bdf5e87d47d5a79c5e033096519 /src/librustc_errors
parent4a8c5b20c7772bc5342b83d4b0696ea216ef75a7 (diff)
downloadrust-0baf61bfdb95980c69fbfcc0fc95ce82e8d81ac9.tar.gz
rust-0baf61bfdb95980c69fbfcc0fc95ce82e8d81ac9.zip
Increase spacing for suggestions in diagnostics
Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index e3b55a14133..e59d6c56750 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -1629,6 +1629,19 @@ impl EmitterWriter {
                             _ => ()
                         }
                     }
+                    if children.is_empty() && suggestions.iter().any(|s| {
+                        s.style != SuggestionStyle::CompletelyHidden
+                    }) {
+                        let mut buffer = StyledBuffer::new();
+                        if !self.short_message {
+                            draw_col_separator_no_space(&mut buffer, 0, max_line_num_len + 1);
+                        }
+                        match emit_to_destination(&buffer.render(), level, &mut self.dst,
+                                                self.short_message) {
+                            Ok(()) => (),
+                            Err(e) => panic!("failed to emit error: {}", e)
+                        }
+                    }
                     for sugg in suggestions {
                         if sugg.style == SuggestionStyle::CompletelyHidden {
                             // do not display this suggestion, it is meant only for tools