Skip to content

Commit

Permalink
Print visibility of macro items
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Sep 15, 2019
1 parent 8bf776d commit b4ef99f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libsyntax/ast.rs
Expand Up @@ -2387,7 +2387,7 @@ pub enum ItemKind {
),
/// A macro invocation.
///
/// E.g., `macro_rules! foo { .. }` or `foo!(..)`.
/// E.g., `foo!(..)`.
Mac(Mac),

/// A macro definition.
Expand Down
8 changes: 6 additions & 2 deletions src/libsyntax/print/pprust.rs
Expand Up @@ -1369,8 +1369,12 @@ impl<'a> State<'a> {
}
}
ast::ItemKind::MacroDef(ref macro_def) => {
let (kw, has_bang) =
if macro_def.legacy { ("macro_rules", true) } else { ("macro", false) };
let (kw, has_bang) = if macro_def.legacy {
("macro_rules", true)
} else {
self.print_visibility(&item.vis);
("macro", false)
};
self.print_mac_common(
Some(MacHeader::Keyword(kw)),
has_bang,
Expand Down
2 changes: 1 addition & 1 deletion src/test/pretty/macro.rs
Expand Up @@ -2,6 +2,6 @@

#![feature(decl_macro)]

macro mac { ($ arg : expr) => { $ arg + $ arg } }
pub(crate) macro mac { ($ arg : expr) => { $ arg + $ arg } }

fn main() { }

0 comments on commit b4ef99f

Please sign in to comment.