about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-31 03:18:00 +0000
committerbors <bors@rust-lang.org>2018-05-31 03:18:00 +0000
commite38554cd80af2e99d626230ad3531b55ee3de65c (patch)
tree48e3949902f9535dd9604512c45c33109f5969f4 /src/libsyntax
parentc1287c018328fb5eaf5c74494ae57241715758f0 (diff)
parent345e7c3597d1f78c5d35f0473f3ad9221f03de04 (diff)
downloadrust-e38554cd80af2e99d626230ad3531b55ee3de65c.tar.gz
rust-e38554cd80af2e99d626230ad3531b55ee3de65c.zip
Auto merge of #51145 - petrochenkov:npbot, r=alexcrichton
resolve: Make sure indeterminate and inconsistent macro resolutions always generate errors

Addresses the issue described in https://github.com/rust-lang/rust/pull/50911#issuecomment-392560525

I haven't come up with a minimized reproduction yet, but confirmed that `npbot` now generates the correct error with `![feature(use_extern_macros)]`.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/base.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index f7d4227977c..7c2eb540a30 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -572,6 +572,16 @@ pub enum MacroKind {
     Derive,
 }
 
+impl MacroKind {
+    pub fn descr(self) -> &'static str {
+        match self {
+            MacroKind::Bang => "macro",
+            MacroKind::Attr => "attribute macro",
+            MacroKind::Derive => "derive macro",
+        }
+    }
+}
+
 /// An enum representing the different kinds of syntax extensions.
 pub enum SyntaxExtension {
     /// A syntax extension that is attached to an item and creates new items