Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to support cargo -Zrustdoc-map with re-exported docs from a proc-macro #110183

Open
Nemo157 opened this issue Apr 11, 2023 · 0 comments
Open
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Nemo157
Copy link
Member

Nemo157 commented Apr 11, 2023

Setup a pair of crates, the first a proc-macro linking to a dependency and the second re-exporting from the first:

> cargo new --lib foo
     Created library `foo` package
> cat <<END >> foo/Cargo.toml
bs58.version = "0.3"
[lib]
proc-macro = true
END
> cat <<'END' > foo/src/lib.rs
/// [`bs58::Alphabet`]
#[proc_macro]
pub fn foo(t: proc_macro::TokenStream) -> proc_macro::TokenStream { t }
END

> cargo new --lib bar
     Created library `bar` package
> echo 'foo.path = "../foo"' >> bar/Cargo.toml
> echo 'pub use foo::foo;' >> bar/src/lib.rs

Now build the docs for the second crate, using -Zrustdoc-map to link dependencies to docs.rs:

> cd bar && cargo rustdoc -Z rustdoc-map --config "doc.extern-map.registries.crates-io=\"https://docs.rs/{pkg_name}/{version}/x86_64-unknown-linux-gnu\""
   Compiling bs58 v0.3.1
   Compiling foo v0.1.0 (/tmp/tmp.VUf54czzNC/foo)
 Documenting bar v0.1.0 (/tmp/tmp.VUf54czzNC/bar)
    Finished dev [unoptimized + debuginfo] target(s) in 0.74s

Expected: Open the docs and the re-exported bar::foo has a resolved link to bs58::Alphabet.
Actual: The link is missing

Prior to #94857 it was possible to hack this into working by adding bs58 as a dependency of bar too, but since that change that no longer works for proc-macro intermediary crates; it still works for non-proc-macros as I assume the crate ids get unified somehow.

@Nemo157 Nemo157 added C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant