From 3893d16341b966df1e1a0acf80cfd00d6159057f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 25 Nov 2019 12:34:56 -0800 Subject: [PATCH] Tweak duplicate matcher binding error --- src/libsyntax_expand/mbe/macro_check.rs | 3 +- .../macro-multiple-matcher-bindings.stderr | 40 ++++++------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/libsyntax_expand/mbe/macro_check.rs b/src/libsyntax_expand/mbe/macro_check.rs index 25754ed42177f..837e04afd3401 100644 --- a/src/libsyntax_expand/mbe/macro_check.rs +++ b/src/libsyntax_expand/mbe/macro_check.rs @@ -269,7 +269,8 @@ fn check_binders( // for nested macro definitions. sess.span_diagnostic .struct_span_err(span, "duplicate matcher binding") - .span_note(prev_info.span, "previous declaration was here") + .span_label(span, "duplicate binding") + .span_label(prev_info.span, "previous binding") .emit(); *valid = false; } else { diff --git a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr index 65362388d7de1..3ad1297ffb2f3 100644 --- a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr +++ b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr @@ -2,49 +2,33 @@ error: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:7:16 | LL | ($a:ident, $a:ident) => {}; - | ^^^^^^^^ - | -note: previous declaration was here - --> $DIR/macro-multiple-matcher-bindings.rs:7:6 - | -LL | ($a:ident, $a:ident) => {}; - | ^^^^^^^^ + | -------- ^^^^^^^^ duplicate binding + | | + | previous binding error: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:8:16 | LL | ($a:ident, $a:path) => {}; - | ^^^^^^^ - | -note: previous declaration was here - --> $DIR/macro-multiple-matcher-bindings.rs:8:6 - | -LL | ($a:ident, $a:path) => {}; - | ^^^^^^^^ + | -------- ^^^^^^^ duplicate binding + | | + | previous binding error: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:17:18 | LL | ($a:ident, $($a:ident),*) => {}; - | ^^^^^^^^ - | -note: previous declaration was here - --> $DIR/macro-multiple-matcher-bindings.rs:17:6 - | -LL | ($a:ident, $($a:ident),*) => {}; - | ^^^^^^^^ + | -------- ^^^^^^^^ duplicate binding + | | + | previous binding error: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:18:25 | LL | ($($a:ident)+ # $($($a:path),+);*) => {}; - | ^^^^^^^ - | -note: previous declaration was here - --> $DIR/macro-multiple-matcher-bindings.rs:18:8 - | -LL | ($($a:ident)+ # $($($a:path),+);*) => {}; - | ^^^^^^^^ + | -------- ^^^^^^^ duplicate binding + | | + | previous binding error: aborting due to 4 previous errors