diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-12-30 14:07:52 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-30 14:07:52 +0900 |
| commit | f70847a863850eb923b0ba5bf855b83e11e324c1 (patch) | |
| tree | 6da507c21052946350c4f20432718ee049cb1530 | |
| parent | 047a4bb43278d24d619580fcea7e22366918388d (diff) | |
| parent | a0d8b794d61098693f53f5e6e7da29e1ea1a1c94 (diff) | |
| download | rust-f70847a863850eb923b0ba5bf855b83e11e324c1.tar.gz rust-f70847a863850eb923b0ba5bf855b83e11e324c1.zip | |
Rollup merge of #67677 - petrochenkov:dupexp, r=Centril
resolve: Minor cleanup of duplicate macro reexports Enabled by https://github.com/rust-lang/rust/pull/65785 which changed `duplicate_macro_exports` from a lint to a hard error.
| -rw-r--r-- | src/librustc_resolve/resolve_imports.rs | 26 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-38715.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-38715.stderr | 14 |
3 files changed, 9 insertions, 33 deletions
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 800c40ffdb1..afbfb647b3c 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -528,31 +528,7 @@ impl<'a> Resolver<'a> { resolution.shadowed_glob = Some(glob_binding); } (false, false) => { - if let (&NameBindingKind::Res(_, true), &NameBindingKind::Res(_, true)) = - (&old_binding.kind, &binding.kind) - { - this.session - .struct_span_err( - binding.span, - &format!( - "a macro named `{}` has already been exported", - key.ident - ), - ) - .span_label( - binding.span, - format!("`{}` already exported", key.ident), - ) - .span_note( - old_binding.span, - "previous macro export is now shadowed", - ) - .emit(); - - resolution.binding = Some(binding); - } else { - return Err(old_binding); - } + return Err(old_binding); } } } else { diff --git a/src/test/ui/issues/issue-38715.rs b/src/test/ui/issues/issue-38715.rs index 7e9defab588..9a9a501cae1 100644 --- a/src/test/ui/issues/issue-38715.rs +++ b/src/test/ui/issues/issue-38715.rs @@ -2,6 +2,6 @@ macro_rules! foo { ($i:ident) => {} } #[macro_export] -macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported +macro_rules! foo { () => {} } //~ ERROR the name `foo` is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-38715.stderr b/src/test/ui/issues/issue-38715.stderr index d7c4f88ff50..c87d9f7360b 100644 --- a/src/test/ui/issues/issue-38715.stderr +++ b/src/test/ui/issues/issue-38715.stderr @@ -1,14 +1,14 @@ -error: a macro named `foo` has already been exported +error[E0428]: the name `foo` is defined multiple times --> $DIR/issue-38715.rs:5:1 | +LL | macro_rules! foo { ($i:ident) => {} } + | ---------------- previous definition of the macro `foo` here +... LL | macro_rules! foo { () => {} } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` already exported - | -note: previous macro export is now shadowed - --> $DIR/issue-38715.rs:2:1 + | ^^^^^^^^^^^^^^^^ `foo` redefined here | -LL | macro_rules! foo { ($i:ident) => {} } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `foo` must be defined only once in the macro namespace of this module error: aborting due to previous error +For more information about this error, try `rustc --explain E0428`. |
