From a220321762ae5b40c87ed7c29b500130e8be88a0 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Wed, 20 Jun 2018 14:01:37 -0500 Subject: [PATCH] use the imported name when rendering an imported macro --- src/librustdoc/clean/inline.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 8bcd1062667..f6269854163 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -104,7 +104,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa // separately Def::Macro(did, MacroKind::Bang) => { record_extern_fqn(cx, did, clean::TypeKind::Macro); - clean::MacroItem(build_macro(cx, did)) + clean::MacroItem(build_macro(cx, did, name)) } _ => return None, }; @@ -463,7 +463,7 @@ fn build_static(cx: &DocContext, did: DefId, mutable: bool) -> clean::Static { } } -fn build_macro(cx: &DocContext, did: DefId) -> clean::Macro { +fn build_macro(cx: &DocContext, did: DefId, name: ast::Name) -> clean::Macro { let imported_from = cx.tcx.original_crate_name(did.krate); let def = match cx.cstore.load_macro_untracked(did, cx.sess()) { LoadedMacro::MacroDef(macro_def) => macro_def, @@ -479,7 +479,7 @@ fn build_macro(cx: &DocContext, did: DefId) -> clean::Macro { }; let source = format!("macro_rules! {} {{\n{}}}", - def.ident.name.clean(cx), + name.clean(cx), matchers.iter().map(|span| { format!(" {} => {{ ... }};\n", span.to_src(cx)) }).collect::());