]> git.lizzy.rs Git - rust.git/commitdiff
use the imported name when rendering an imported macro
authorQuietMisdreavus <grey@quietmisdreavus.net>
Wed, 20 Jun 2018 19:01:37 +0000 (14:01 -0500)
committerQuietMisdreavus <grey@quietmisdreavus.net>
Wed, 20 Jun 2018 19:01:37 +0000 (14:01 -0500)
src/librustdoc/clean/inline.rs

index 8bcd10626674d76300ca45a1d04a1c60e27dc016..f6269854163b1d80de4f39c14124f88a6ad9b8d4 100644 (file)
@@ -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::<String>());