Print visibility of `macro` items

This commit is contained in:
Matthew Jasper 2019-07-14 20:16:16 +01:00
parent 8bf776d5c2
commit b4ef99f4a6
3 changed files with 8 additions and 4 deletions

View File

@ -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.

View File

@ -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,

View File

@ -2,6 +2,6 @@
#![feature(decl_macro)]
macro mac { ($ arg : expr) => { $ arg + $ arg } }
pub(crate) macro mac { ($ arg : expr) => { $ arg + $ arg } }
fn main() { }