Skip to content

Commit

Permalink
use the imported name when rendering an imported macro
Browse files Browse the repository at this point in the history
  • Loading branch information
QuietMisdreavus committed Jun 20, 2018
1 parent 5e50950 commit a220321
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustdoc/clean/inline.rs
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
Expand All @@ -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::<String>());
Expand Down

0 comments on commit a220321

Please sign in to comment.