Skip to content

Commit b4ef99f

Browse files
committed
Print visibility of macro items
1 parent 8bf776d commit b4ef99f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/libsyntax/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2387,7 +2387,7 @@ pub enum ItemKind {
23872387
),
23882388
/// A macro invocation.
23892389
///
2390-
/// E.g., `macro_rules! foo { .. }` or `foo!(..)`.
2390+
/// E.g., `foo!(..)`.
23912391
Mac(Mac),
23922392

23932393
/// A macro definition.

src/libsyntax/print/pprust.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1369,8 +1369,12 @@ impl<'a> State<'a> {
13691369
}
13701370
}
13711371
ast::ItemKind::MacroDef(ref macro_def) => {
1372-
let (kw, has_bang) =
1373-
if macro_def.legacy { ("macro_rules", true) } else { ("macro", false) };
1372+
let (kw, has_bang) = if macro_def.legacy {
1373+
("macro_rules", true)
1374+
} else {
1375+
self.print_visibility(&item.vis);
1376+
("macro", false)
1377+
};
13741378
self.print_mac_common(
13751379
Some(MacHeader::Keyword(kw)),
13761380
has_bang,

src/test/pretty/macro.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
#![feature(decl_macro)]
44

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

77
fn main() { }

0 commit comments

Comments
 (0)