diff options
| author | bors <bors@rust-lang.org> | 2018-07-21 23:50:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-21 23:50:28 +0000 |
| commit | 0ad6179d3b50101cd7530e24eca9995a730ac8d9 (patch) | |
| tree | 474dd27814e2358c7532fce8c8048b08fee147ec /src/librustc_errors | |
| parent | 874dec25ed4c08d36f17d396b6872ca50313fc8e (diff) | |
| parent | ed5dcc31182631a8df8818f4896179177d607fcf (diff) | |
Auto merge of #51485 - estebank:dehighlight-secondary-msgs, r=GuillaumeGomez
Remove highlighting from secondary messages Deemphasize the secondary messages so that all other highlights stand out more. <img width="684" alt="" src="https://user-images.githubusercontent.com/1606434/41261199-7b4fe96e-6d8f-11e8-8619-04d170617df2.png">
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 14 | ||||
| -rw-r--r-- | src/librustc_errors/snippet.rs | 1 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 2f71c3a7232..c9b6818d5c1 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -963,6 +963,11 @@ impl EmitterWriter { is_secondary: bool) -> io::Result<()> { let mut buffer = StyledBuffer::new(); + let header_style = if is_secondary { + Style::HeaderMsg + } else { + Style::MainHeaderMsg + }; if msp.primary_spans().is_empty() && msp.span_labels().is_empty() && is_secondary && !self.short_message { @@ -973,7 +978,7 @@ impl EmitterWriter { draw_note_separator(&mut buffer, 0, max_line_num_len + 1); let level_str = level.to_string(); if !level_str.is_empty() { - buffer.append(0, &level_str, Style::HeaderMsg); + buffer.append(0, &level_str, Style::MainHeaderMsg); buffer.append(0, ": ", Style::NoStyle); } self.msg_to_buffer(&mut buffer, msg, max_line_num_len, "note", None); @@ -989,10 +994,10 @@ impl EmitterWriter { buffer.append(0, "]", Style::Level(level.clone())); } if !level_str.is_empty() { - buffer.append(0, ": ", Style::HeaderMsg); + buffer.append(0, ": ", header_style); } for &(ref text, _) in msg.iter() { - buffer.append(0, text, Style::HeaderMsg); + buffer.append(0, text, header_style); } } @@ -1521,7 +1526,7 @@ impl<'a> WritableDst<'a> { } } Style::Quotation => {} - Style::OldSchoolNoteText | Style::HeaderMsg => { + Style::OldSchoolNoteText | Style::MainHeaderMsg => { spec.set_bold(true); if cfg!(windows) { spec.set_intense(true) @@ -1542,6 +1547,7 @@ impl<'a> WritableDst<'a> { spec.set_fg(Some(Color::Blue)); } } + Style::HeaderMsg | Style::NoStyle => {} Style::Level(lvl) => { spec = lvl.color(); diff --git a/src/librustc_errors/snippet.rs b/src/librustc_errors/snippet.rs index 7d416f13ffc..002261dc1a5 100644 --- a/src/librustc_errors/snippet.rs +++ b/src/librustc_errors/snippet.rs @@ -182,6 +182,7 @@ pub struct StyledString { #[derive(Copy, Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)] pub enum Style { + MainHeaderMsg, HeaderMsg, LineAndColumn, LineNumber, |
