Skip to content

Commit c007f43

Browse files
committed
Add test, fix pub macro impl, compile error
1 parent 18276b2 commit c007f43

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/librustdoc/clean/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2333,15 +2333,16 @@ impl Clean<Item> for (&hir::MacroDef<'_>, Option<Ident>) {
23332333
// This code currently assumes that there will only be one or zero matchers, as syntax
23342334
// for multiple is not currently defined.
23352335
format!(
2336-
"pub macro {}({}) {{\n\t...\n}}",
2336+
"{}macro {}{} {{\n\t...\n}}",
2337+
item.vis.clean(cx).print_with_space(),
23372338
name,
23382339
matchers.iter().map(|span| span.to_src(cx)).collect::<String>(),
23392340
)
23402341
};
23412342

23422343
Item::from_hir_id_and_parts(
23432344
item.hir_id,
2344-
Some(name.clean(cx)),
2345+
Some(name),
23452346
MacroItem(Macro { source, imported_from: None }),
23462347
cx,
23472348
)

src/test/rustdoc/macros_2.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
#![feature(decl_macro)]
3+
4+
// @has macros_2/macro.my_macro.html //pre 'pub macro my_macro() {'
5+
// @has - //pre '...'
6+
// @has - //pre '}'
7+
pub macro my_macro() {
8+
9+
}
10+
11+
// @has macros_2/macro.my_macro_2.html //pre 'pub macro my_macro_2($($tok:tt)*) {'
12+
// @has - //pre '...'
13+
// @has - //pre '}'
14+
pub macro my_macro_2($($tok:tt)*) {
15+
16+
}

0 commit comments

Comments
 (0)