Change:
See for []: ! But when you click on : Or for []: ! With source: Or for [], which is not a built-in: ! []: []: []: modify labels: T-rustdoc C-bug
Related:
I have a hunch that and are both represented as and/or .
Cc
I would experiment to see if that is what's causing it, but I'm waiting on a build for something else
https://rustc-dev-
Wow, I never noticed that! That's so cool :)
Indeed, changing changed the output. See if you can notice my experimental change ;) ! And for a built-in: !

Discussion:
} } <del> impl Clean<Item> for doctree::Macro { </del> <ins> impl Clean<Item> for (&hir::MacroDef<'_>, Option<Ident>) { </ins> fn clean(&self, cx: &DocContext<'_>) -> Item { <del> Item::from_def_id_and_parts( self.def_id, Some(self.name.clean(cx)), MacroItem(Macro { source: format!( "macro_rules! {} {{n{}}}", self.name, self.matchers </del> <ins> let (item, renamed) = self; let name = renamed.unwrap_or(item.ident).name; let tts = item.ast.body.inner_tokens().trees().collect::<Vec<_>>(); // Extract the spans of all matchers. They represent the "interface" of the macro. let matchers = tts.chunks(4).map(|arm| arm[0].span()).collect::<Vec<_>>(); let source = if item.ast.macro_rules { format!( "macro_rules! {} {{n{}}}", name, matchers .iter() .map(|span| { format!("    {} => {{ ... }};n", span.to_src(cx)) }) .collect::<String>(), ) } else { let vis = item.vis.clean(cx); if matchers.len() <= 1 { format!( "{}macro {}{} {{n    ...n}}", vis.print_with_space(), name, matchers.iter().map(|span| span.to_src(cx)).collect::<String>(), ) } else { format!( "{}macro {} {{n{}}}", vis.print_with_space(), name, matchers </ins> .iter() <del> .map(|span| { format!("    {} => {{ ... }};n", span.to_src(cx)) }) .collect::<String>() ), imported_from: self.imported_from.clean(cx), }), </del> <ins> .map(|span| { format!("    {} => {{ ... }},n", span.to_src(cx)) }) .collect::<String>(), ) } }; Item::from_hir_id_and_parts( item.hir_id, Some(name), MacroItem(Macro { source, imported_from: None }), </ins> cx, ) }

// (item, renamed) crate items: Vec<(&'hir hir::Item<'hir>, Option<Ident>)>, crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Ident>)>, <del> crate macros: Vec<Macro>, </del> <ins> crate macros: Vec<(&'hir hir::MacroDef<'hir>, Option<Ident>)>, </ins> crate is_crate: bool, }

crate def: &'hir hir::VariantData<'hir>, } <del> // For Macro we store the DefId instead of the NodeId, since we also create // these imported macro_rules (which only have a DUMMY_NODE_ID). crate struct Macro { crate name: Symbol, crate def_id: hir::def_id::DefId, crate matchers: Vec<Span>, crate imported_from: Option<Symbol>, } </del> #[derive(Debug)] crate struct Import<'hir> { crate name: Symbol,

None, ); // Attach the crate's exported macros to the top-level module: <del> module .macros .extend(krate.exported_macros.iter().map(|def| self.visit_local_macro(def, None))); </del> <ins> module.macros.extend(krate.exported_macros.iter().map(|def| (def, None))); </ins> module.is_crate = true; self.cx.renderinfo.get_mut().exact_paths = self.exact_paths;

true } Node::MacroDef(def) if !glob => { <del> om.macros.push(self.visit_local_macro(def, renamed.map(|i| i.name))); </del> <ins> om.macros.push((def, renamed)); </ins> true } _ => false,

om.foreigns.push((item, renamed)); } } <del> // Convert each `exported_macro` into a doc item. fn visit_local_macro(&self, def: &'tcx hir::MacroDef<'_>, renamed: Option<Symbol>) -> Macro { debug!("visit_local_macro: {}", def.ident); let tts = def.ast.body.inner_tokens().trees().collect::<Vec<_>>(); // Extract the spans of all matchers. They represent the "interface" of the macro. let matchers = tts.chunks(4).map(|arm| arm[0].span()).collect(); Macro { def_id: self.cx.tcx.hir().local_def_id(def.hir_id).to_def_id(), name: renamed.unwrap_or(def.ident.name), matchers, imported_from: None, } } </del> }

<ins> #![feature(decl_macro)] // @has decl_macro/macro.my_macro.html //pre 'pub macro my_macro() {' // @has - //pre '...' // @has - //pre '}' pub macro my_macro() { } // @has decl_macro/macro.my_macro_2.html //pre 'pub macro my_macro_2($($tok:tt)*) {' // @has - //pre '...' // @has - //pre '}' pub macro my_macro_2($($tok:tt)*) { } // @has decl_macro/macro.my_macro_multi.html //pre 'pub macro my_macro_multi {' // @has - //pre '(_) => { ... },' // @has - //pre '($foo:ident . $bar:expr) => { ... },' // @has - //pre '($($foo:literal),+) => { ... }' // @has - //pre '}' pub macro my_macro_multi { (_) => { }, ($foo:ident . $bar:expr) => { }, ($($foo:literal),+) => { } } // @has decl_macro/macro.by_example_single.html //pre 'pub macro by_example_single($foo:expr) {' // @has - //pre '...' // @has - //pre '}' pub macro by_example_single { ($foo:expr) => {} } </ins>

<ins> // compile-flags: --document-private-items #![feature(decl_macro)] // @has decl_macro_priv/macro.crate_macro.html //pre 'pub(crate) macro crate_macro() {' // @has - //pre '...' // @has - //pre '}' pub(crate) macro crate_macro() {} // @has decl_macro_priv/macro.priv_macro.html //pre 'macro priv_macro() {' // @!has - //pre 'pub macro priv_macro() {' // @has - //pre '...' // @has - //pre '}' macro priv_macro() {} </ins>