mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-13 23:42:56 +00:00
Add test, fix pub macro impl, compile error
This commit is contained in:
parent
18276b2dbd
commit
c007f4354d
@ -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
|
||||
// for multiple is not currently defined.
|
||||
format!(
|
||||
"pub macro {}({}) {{\n\t...\n}}",
|
||||
"{}macro {}{} {{\n\t...\n}}",
|
||||
item.vis.clean(cx).print_with_space(),
|
||||
name,
|
||||
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.hir_id,
|
||||
Some(name.clean(cx)),
|
||||
Some(name),
|
||||
MacroItem(Macro { source, imported_from: None }),
|
||||
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…
Reference in New Issue
Block a user