};
let res = Res::Def(DefKind::Macro(ext.macro_kind()), def_id.to_def_id());
- let is_macro_export = self.r.session.contains_name(&item.attrs, sym::macro_export);
self.r.macro_map.insert(def_id.to_def_id(), ext);
self.r.local_macro_def_scopes.insert(def_id, parent_scope.module);
- if macro_rules && matches!(item.vis.kind, ast::VisibilityKind::Inherited) {
+ if macro_rules {
let ident = ident.normalize_to_macros_2_0();
self.r.macro_names.insert(ident);
+ let is_macro_export = self.r.session.contains_name(&item.attrs, sym::macro_export);
let vis = if is_macro_export {
ty::Visibility::Public
} else {
}),
))
} else {
- if is_macro_export {
- let what = if macro_rules { "`macro_rules` with `pub`" } else { "`macro` items" };
- let msg = format!("`#[macro_export]` cannot be used on {what}");
- self.r.session.span_err(item.span, &msg);
- }
let module = parent_scope.module;
let vis = match item.kind {
// Visibilities must not be resolved non-speculatively twice