File tree 1 file changed +8
-14
lines changed
compiler/rustc_privacy/src
1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -832,21 +832,15 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
832
832
}
833
833
834
834
fn visit_macro_def ( & mut self , md : & ' tcx hir:: MacroDef < ' tcx > ) {
835
- // HACK (or fix?): a
836
- // ```rust,ignore (dummy example)
837
- // mod private {
838
- // #[rustc_macro_transparency(semitransparent)]
839
- // pub macro m { … }
840
- // }
841
- // ```
842
- // is *not* `Public`ly reachable and yet this shortcut would express
843
- // that.
844
- // FIXME!
845
- if md. ast . macro_rules
846
- && attr:: find_transparency ( & self . tcx . sess , & md. attrs , md. ast . macro_rules ) . 0
847
- != Transparency :: Opaque
835
+ // Non-opaque macros cannot make other items more accessible than they already are.
836
+ if attr:: find_transparency ( & self . tcx . sess , & md. attrs , md. ast . macro_rules ) . 0
837
+ != Transparency :: Opaque
848
838
{
849
- self . update ( md. hir_id , Some ( AccessLevel :: Public ) ) ;
839
+ // `#[macro_export]`-ed `macro_rules!` are `Public` since they
840
+ // ignore their containing path to always appear at the crate root.
841
+ if md. ast . macro_rules {
842
+ self . update ( md. hir_id , Some ( AccessLevel :: Public ) ) ;
843
+ }
850
844
return ;
851
845
}
852
846
You can’t perform that action at this time.
0 commit comments