about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-01-31 07:53:57 +0000
committerbors <bors@rust-lang.org>2018-01-31 07:53:57 +0000
commit560a2f4faf4828ba5f48fe2bd7709265c2f5354d (patch)
tree14d4693f6908a4f3f7ece6cf63c00cff4d540a9b /src/libsyntax
parentb8f2674ea47f4f3cf5d90d0428bf8b8025d7f8d8 (diff)
parent08287c1e26c6faa18c145a8a794fdd25408217a4 (diff)
downloadrust-560a2f4faf4828ba5f48fe2bd7709265c2f5354d.tar.gz
rust-560a2f4faf4828ba5f48fe2bd7709265c2f5354d.zip
Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakis
Highlight code on diagnostics when underlined

Highlight the label's span with the respective color:

<img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png">

Fix #42112.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/json.rs2
-rw-r--r--src/libsyntax/parse/lexer/mod.rs1
-rw-r--r--src/libsyntax/test_snippet.rs1
3 files changed, 3 insertions, 1 deletions
diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs
index 54c726d8462..7635ec26b28 100644
--- a/src/libsyntax/json.rs
+++ b/src/libsyntax/json.rs
@@ -188,7 +188,7 @@ impl Diagnostic {
         }
         let buf = BufWriter::default();
         let output = buf.clone();
-        EmitterWriter::new(Box::new(buf), Some(je.cm.clone()), false).emit(db);
+        EmitterWriter::new(Box::new(buf), Some(je.cm.clone()), false, false).emit(db);
         let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap();
         let output = String::from_utf8(output).unwrap();
 
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index b95c91548d0..0fd069b76aa 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -1745,6 +1745,7 @@ mod tests {
     fn mk_sess(cm: Rc<CodeMap>) -> ParseSess {
         let emitter = errors::emitter::EmitterWriter::new(Box::new(io::sink()),
                                                           Some(cm.clone()),
+                                                          false,
                                                           false);
         ParseSess {
             span_diagnostic: errors::Handler::with_emitter(true, false, Box::new(emitter)),
diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs
index 5072f2e2793..3b4bba24d77 100644
--- a/src/libsyntax/test_snippet.rs
+++ b/src/libsyntax/test_snippet.rs
@@ -62,6 +62,7 @@ fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &
 
     let emitter = EmitterWriter::new(Box::new(Shared { data: output.clone() }),
                                      Some(code_map.clone()),
+                                     false,
                                      false);
     let handler = Handler::with_emitter(true, false, Box::new(emitter));
     handler.span_err(msp, "foo");