about summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuietMisdreavus <grey@quietmisdreavus.net>2018-09-25 16:15:32 -0500
committerQuietMisdreavus <grey@quietmisdreavus.net>2018-09-25 16:15:32 -0500
commitf05b744b083598f3a34d02ac55d27bb144d99e8a (patch)
treef06a930805a416da00807f251bf3ec151ce9b2dc
parentaea1bd0a5908430d41b6f2d38240f2652ef5651f (diff)
downloadrust-f05b744b083598f3a34d02ac55d27bb144d99e8a.tar.gz
rust-f05b744b083598f3a34d02ac55d27bb144d99e8a.zip
disable proc-macro re-export inlining
Proc-macros don't emit their attributes or source spans across crates.
This means that rustdoc can't actually see the docs of a proc-macro if
it wasn't defined in the active crate, and attempting to inline it
creates an empty page with no docs or source link. In lieu of attempting
to fix that immediately, this commit forces proc-macro re-exports to
never inline, which at least creates usable links to complete
documentation.
-rw-r--r--src/librustdoc/clean/inline.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 287637ae0da..4d1b6b8b1a9 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -105,14 +105,15 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
             record_extern_fqn(cx, did, clean::TypeKind::Const);
             clean::ConstantItem(build_const(cx, did))
         }
-        Def::Macro(did, mac_kind) => {
-            match mac_kind {
-                MacroKind::Bang => record_extern_fqn(cx, did, clean::TypeKind::Macro),
-                MacroKind::Attr => record_extern_fqn(cx, did, clean::TypeKind::Attr),
-                MacroKind::Derive => record_extern_fqn(cx, did, clean::TypeKind::Derive),
-                MacroKind::ProcMacroStub => return None,
+        // FIXME: proc-macros don't propagate attributes or spans across crates, so they look empty
+        Def::Macro(did, MacroKind::Bang) => {
+            let mac = build_macro(cx, did, name);
+            if let clean::MacroItem(..) = mac {
+                record_extern_fqn(cx, did, clean::TypeKind::Macro);
+                mac
+            } else {
+                return None;
             }
-            build_macro(cx, did, name)
         }
         _ => return None,
     };