about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-04-11 16:58:04 -0400
committerNiko Matsakis <niko@alum.mit.edu>2017-04-11 20:32:47 -0400
commit14f1e3459f02e3ce45232a84cd923c86eef55cb5 (patch)
tree00999979b018118bab6c4610974e1f6eba5bf2ce /src/tools/compiletest
parent77d9e38e9499df1dac393937d62d3bf626c51abb (diff)
fix a bug in compiletest JSON parsing for duplicate errors
In some cases, we give multiple primary spans, in which case we would
report one `//~` annotation per primary span. That was very confusing
because these things are reported to the user as a single error.

UI tests would be better here.
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/json.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs
index d9da1bdc348..06cbd9a3df4 100644
--- a/src/tools/compiletest/src/json.rs
+++ b/src/tools/compiletest/src/json.rs
@@ -97,6 +97,7 @@ fn push_expected_errors(expected_errors: &mut Vec<Error>,
     let primary_spans: Vec<_> = spans_in_this_file.iter()
         .cloned()
         .filter(|span| span.is_primary)
+        .take(1) // sometimes we have more than one showing up in the json; pick first
         .collect();
     let primary_spans = if primary_spans.is_empty() {
         // subdiagnostics often don't have a span of their own;