Skip to content

Commit

Permalink
disable proc-macro re-export inlining
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
QuietMisdreavus committed Sep 25, 2018
1 parent aea1bd0 commit f05b744
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/librustdoc/clean/inline.rs
Expand Up @@ -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,
};
Expand Down

0 comments on commit f05b744

Please sign in to comment.