Skip to content

Commit

Permalink
Tweak duplicate matcher binding error
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 25, 2019
1 parent 1eeed17 commit 3893d16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
3 changes: 2 additions & 1 deletion src/libsyntax_expand/mbe/macro_check.rs
Expand Up @@ -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 {
Expand Down
40 changes: 12 additions & 28 deletions src/test/ui/macros/macro-multiple-matcher-bindings.stderr
Expand Up @@ -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

0 comments on commit 3893d16

Please sign in to comment.