about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/lib.rs
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-06-15 12:02:05 +0900
committerGitHub <noreply@github.com>2022-06-15 12:02:05 +0900
commitb2d0e7838e2af58b9abeab10dcb954e39fa634b5 (patch)
tree0ea12520a01d8e23f5ee8120d697edfbaa4fbf4d /compiler/rustc_resolve/src/lib.rs
parent97b9347c93726e6f27b7d45d1d3bda62d6cff2b4 (diff)
parentd29915af79f4a372647b67e7d83f1fc4aabbb92a (diff)
downloadrust-b2d0e7838e2af58b9abeab10dcb954e39fa634b5.tar.gz
rust-b2d0e7838e2af58b9abeab10dcb954e39fa634b5.zip
Rollup merge of #98087 - TaKO8Ki:suggest-adding-macro-export, r=oli-obk
Suggest adding a `#[macro_export]` to a private macro

fixes #97628
Diffstat (limited to 'compiler/rustc_resolve/src/lib.rs')
-rw-r--r--compiler/rustc_resolve/src/lib.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs
index 92a65fe249f..ac4e23cc04d 100644
--- a/compiler/rustc_resolve/src/lib.rs
+++ b/compiler/rustc_resolve/src/lib.rs
@@ -866,6 +866,12 @@ struct DeriveData {
     has_derive_copy: bool,
 }
 
+#[derive(Clone)]
+struct MacroData {
+    ext: Lrc<SyntaxExtension>,
+    macro_rules: bool,
+}
+
 /// The main resolver class.
 ///
 /// This is the visitor that walks the whole crate.
@@ -965,7 +971,7 @@ pub struct Resolver<'a> {
     registered_attrs: FxHashSet<Ident>,
     registered_tools: RegisteredTools,
     macro_use_prelude: FxHashMap<Symbol, &'a NameBinding<'a>>,
-    macro_map: FxHashMap<DefId, Lrc<SyntaxExtension>>,
+    macro_map: FxHashMap<DefId, MacroData>,
     dummy_ext_bang: Lrc<SyntaxExtension>,
     dummy_ext_derive: Lrc<SyntaxExtension>,
     non_macro_attr: Lrc<SyntaxExtension>,
@@ -1522,7 +1528,7 @@ impl<'a> Resolver<'a> {
     }
 
     fn is_builtin_macro(&mut self, res: Res) -> bool {
-        self.get_macro(res).map_or(false, |ext| ext.builtin_name.is_some())
+        self.get_macro(res).map_or(false, |macro_data| macro_data.ext.builtin_name.is_some())
     }
 
     fn macro_def(&self, mut ctxt: SyntaxContext) -> DefId {