about summary refs log tree commit diff
path: root/src/librustc_errors/emitter.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-01-27 21:04:50 -0800
committerEsteban Küber <esteban@kuber.com.ar>2019-02-07 01:41:30 -0800
commit7451cd8dc0b20c012fad1886b321c3dee2052577 (patch)
tree564bb3390199f080413ec319481f3f37fa345054 /src/librustc_errors/emitter.rs
parent825f355c7483746f3a17166f34dfabe3b2df1741 (diff)
downloadrust-7451cd8dc0b20c012fad1886b321c3dee2052577.tar.gz
rust-7451cd8dc0b20c012fad1886b321c3dee2052577.zip
Deduplicate mismatched delimiter errors
Delay unmatched delimiter errors until after the parser has run to
deduplicate them when parsing and attempt recovering intelligently.
Diffstat (limited to 'src/librustc_errors/emitter.rs')
-rw-r--r--src/librustc_errors/emitter.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 25d09a33c15..f04bd7b8f02 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -674,8 +674,8 @@ impl EmitterWriter {
         //   | |  something about `foo`
         //   | something about `fn foo()`
         annotations_position.sort_by(|a, b| {
-            // Decreasing order
-            a.1.len().cmp(&b.1.len()).reverse()
+            // Decreasing order. When `a` and `b` are the same length, prefer `Primary`.
+            (a.1.len(), !a.1.is_primary).cmp(&(b.1.len(), !b.1.is_primary)).reverse()
         });
 
         // Write the underlines.