Skip to content

Commit f05b744

Browse files
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.
1 parent aea1bd0 commit f05b744

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,15 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
105105
record_extern_fqn(cx, did, clean::TypeKind::Const);
106106
clean::ConstantItem(build_const(cx, did))
107107
}
108-
Def::Macro(did, mac_kind) => {
109-
match mac_kind {
110-
MacroKind::Bang => record_extern_fqn(cx, did, clean::TypeKind::Macro),
111-
MacroKind::Attr => record_extern_fqn(cx, did, clean::TypeKind::Attr),
112-
MacroKind::Derive => record_extern_fqn(cx, did, clean::TypeKind::Derive),
113-
MacroKind::ProcMacroStub => return None,
108+
// FIXME: proc-macros don't propagate attributes or spans across crates, so they look empty
109+
Def::Macro(did, MacroKind::Bang) => {
110+
let mac = build_macro(cx, did, name);
111+
if let clean::MacroItem(..) = mac {
112+
record_extern_fqn(cx, did, clean::TypeKind::Macro);
113+
mac
114+
} else {
115+
return None;
114116
}
115-
build_macro(cx, did, name)
116117
}
117118
_ => return None,
118119
};

0 commit comments

Comments
 (0)