about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2018-06-08 17:20:55 -0600
committerGitHub <noreply@github.com>2018-06-08 17:20:55 -0600
commit91b6842dc9b795cdee9bfe552f42cdd463e1a8dd (patch)
treedccf7c5551e42de61416819a366233e2bc6a1866 /src/test/ui
parentc40275b34f8a2b6a289181d1d5f376ff7c64f0c5 (diff)
parent11c283cdfc536c2d0c984bea47c7ab246d4ed5d3 (diff)
downloadrust-91b6842dc9b795cdee9bfe552f42cdd463e1a8dd.tar.gz
rust-91b6842dc9b795cdee9bfe552f42cdd463e1a8dd.zip
Rollup merge of #50143 - petrochenkov:mexuniq, r=nikomatsakis
Add deprecation lint for duplicated `macro_export`s

cc https://github.com/rust-lang/rust/issues/35896#issuecomment-381370556
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/issue-38715.rs16
-rw-r--r--src/test/ui/issue-38715.stderr22
2 files changed, 38 insertions, 0 deletions
diff --git a/src/test/ui/issue-38715.rs b/src/test/ui/issue-38715.rs
new file mode 100644
index 00000000000..552653c21ba
--- /dev/null
+++ b/src/test/ui/issue-38715.rs
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[macro_export]
+macro_rules! foo { ($i:ident) => {} }
+
+#[macro_export]
+macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported
+                              //~| WARN this was previously accepted
diff --git a/src/test/ui/issue-38715.stderr b/src/test/ui/issue-38715.stderr
new file mode 100644
index 00000000000..a0dbcbd18c6
--- /dev/null
+++ b/src/test/ui/issue-38715.stderr
@@ -0,0 +1,22 @@
+error: a macro named `foo` has already been exported
+  --> $DIR/issue-38715.rs:15:1
+   |
+LL | macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` already exported
+   |
+   = note: #[deny(duplicate_macro_exports)] on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
+   = note: for more information, see issue #35896 <https://github.com/rust-lang/rust/issues/35896>
+note: previous macro export is now shadowed
+  --> $DIR/issue-38715.rs:12:1
+   |
+LL | macro_rules! foo { ($i:ident) => {} }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0601]: `main` function not found in crate `issue_38715`
+   |
+   = note: consider adding a `main` function to `$DIR/issue-38715.rs`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0601`.