Add test, fix pub macro impl, compile error
This commit is contained in:
parent
18276b2dbd
commit
c007f4354d
2 changed files with 19 additions and 2 deletions
|
@ -2333,7 +2333,8 @@ impl Clean<Item> for (&hir::MacroDef<'_>, Option<Ident>) {
|
||||||
// This code currently assumes that there will only be one or zero matchers, as syntax
|
// This code currently assumes that there will only be one or zero matchers, as syntax
|
||||||
// for multiple is not currently defined.
|
// for multiple is not currently defined.
|
||||||
format!(
|
format!(
|
||||||
"pub macro {}({}) {{\n\t...\n}}",
|
"{}macro {}{} {{\n\t...\n}}",
|
||||||
|
item.vis.clean(cx).print_with_space(),
|
||||||
name,
|
name,
|
||||||
matchers.iter().map(|span| span.to_src(cx)).collect::<String>(),
|
matchers.iter().map(|span| span.to_src(cx)).collect::<String>(),
|
||||||
)
|
)
|
||||||
|
@ -2341,7 +2342,7 @@ impl Clean<Item> for (&hir::MacroDef<'_>, Option<Ident>) {
|
||||||
|
|
||||||
Item::from_hir_id_and_parts(
|
Item::from_hir_id_and_parts(
|
||||||
item.hir_id,
|
item.hir_id,
|
||||||
Some(name.clean(cx)),
|
Some(name),
|
||||||
MacroItem(Macro { source, imported_from: None }),
|
MacroItem(Macro { source, imported_from: None }),
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
|
|
16
src/test/rustdoc/macros_2.rs
Normal file
16
src/test/rustdoc/macros_2.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
#![feature(decl_macro)]
|
||||||
|
|
||||||
|
// @has macros_2/macro.my_macro.html //pre 'pub macro my_macro() {'
|
||||||
|
// @has - //pre '...'
|
||||||
|
// @has - //pre '}'
|
||||||
|
pub macro my_macro() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @has macros_2/macro.my_macro_2.html //pre 'pub macro my_macro_2($($tok:tt)*) {'
|
||||||
|
// @has - //pre '...'
|
||||||
|
// @has - //pre '}'
|
||||||
|
pub macro my_macro_2($($tok:tt)*) {
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue