-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[rustdoc] --static-root-path is ignored for proc macro crates if --target is also passed #66796
Comments
This is a Cargo bug, which is easier to demonstrate not directly on $ RUSTDOCFLAGS="-Z unstable-options --static-root-path /" cargo +nightly doc --target x86_64-pc-windows-gnu --verbose
(...cutting out other crate builds...)
Documenting rstest v0.4.1
Running `rustdoc --edition=2018 --crate-type proc-macro --crate-name rstest /home/misdreavus/.cargo/registry/src/github.com-1ecc6299db9ec823/rstest-0.4.1/src/lib.rs --cap-lints allow -o /home/misdreavus/git/asdf/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/misdreavus/git/asdf/target/debug/deps --extern cfg_if=/home/misdreavus/git/asdf/target/debug/deps/libcfg_if-e81fd561ea5d778d.rmeta --extern itertools=/home/misdreavus/git/asdf/target/debug/deps/libitertools-fc795270e0118033.rmeta --extern proc_macro2=/home/misdreavus/git/asdf/target/debug/deps/libproc_macro2-28ac7b73e9431dcd.rmeta --extern quote=/home/misdreavus/git/asdf/target/debug/deps/libquote-c3d8fb0ee445b121.rmeta --extern syn=/home/misdreavus/git/asdf/target/debug/deps/libsyn-3cb4f46f3856d11c.rmeta --cfg use_proc_macro_diagnostic`
Documenting asdf v0.1.0 (/home/misdreavus/git/asdf)
Running `rustdoc --edition=2018 --crate-type lib --crate-name asdf src/lib.rs --target x86_64-pc-windows-gnu -o /home/misdreavus/git/asdf/target/x86_64-pc-windows-gnu/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/misdreavus/git/asdf/target/x86_64-pc-windows-gnu/debug/deps -L dependency=/home/misdreavus/git/asdf/target/debug/deps --extern qwop=/home/misdreavus/git/asdf/target/x86_64-pc-windows-gnu/debug/deps/libqwop-00f1cec7bc7f8935.rmeta --extern rstest=/home/misdreavus/git/asdf/target/debug/deps/librstest-4735249459e3b68f.so -Z unstable-options --static-root-path /`
Finished dev [unoptimized + debuginfo] target(s) in 21.89s Compare the commands given for This effect is more pronounced when the leaf crate is itself a proc-macro crate; there, all the docs go into $ RUSTDOCFLAGS="-Z unstable-options --static-root-path /" cargo +nightly doc --target x86_64-pc-windows-gnu --verbose
(...cutting out other crate builds...)
Documenting syn v1.0.5
Running `rustdoc --edition=2018 --crate-type lib --crate-name syn /home/misdreavus/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.5/src/lib.rs --cap-lints allow -o /home/misdreavus/clones/rstest/target/doc --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="extra-traits"' --cfg 'feature="full"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="quote"' --cfg 'feature="visit"' --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/misdreavus/clones/rstest/target/debug/deps --extern proc_macro2=/home/misdreavus/clones/rstest/target/debug/deps/libproc_macro2-28ac7b73e9431dcd.rmeta --extern quote=/home/misdreavus/clones/rstest/target/debug/deps/libquote-c3d8fb0ee445b121.rmeta --extern unicode_xid=/home/misdreavus/clones/rstest/target/debug/deps/libunicode_xid-87ca1b5df9f4f475.rmeta`
Documenting rstest v0.4.0 (/home/misdreavus/clones/rstest)
Running `rustdoc --edition=2018 --crate-type proc-macro --crate-name rstest src/lib.rs -o /home/misdreavus/clones/rstest/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/misdreavus/clones/rstest/target/debug/deps --extern cfg_if=/home/misdreavus/clones/rstest/target/debug/deps/libcfg_if-e81fd561ea5d778d.rmeta --extern itertools=/home/misdreavus/clones/rstest/target/debug/deps/libitertools-6b909a299a131f9f.rmeta --extern proc_macro2=/home/misdreavus/clones/rstest/target/debug/deps/libproc_macro2-28ac7b73e9431dcd.rmeta --extern quote=/home/misdreavus/clones/rstest/target/debug/deps/libquote-c3d8fb0ee445b121.rmeta --extern syn=/home/misdreavus/clones/rstest/target/debug/deps/libsyn-c9363dee89805d6e.rmeta --cfg use_proc_macro_diagnostic`
Finished dev [unoptimized + debuginfo] target(s) in 11.01s Note here that neither |
Looks like this is rust-lang/cargo#4423. |
That seems to be about build scripts, though - does it apply to proc-macros as well? |
I think so, see rust-lang/cargo#4423 (comment) and rust-lang/cargo#4423 (comment) |
I believe this is a Cargo bug, not a bug in rustdoc, so closing (the option just isn't passed). |
I've been on a wild ride trying to figure out exactly what's been going on.
Minimal example: clone https://github.com/la10736/rstest and run
RUSTDOCFLAGS="-Z unstable-options --static-root-path /" cargo +nightly doc --target x86_64-unknown-linux-gnu
. The links to static files should start with/
; instead they start with../
.Note that if you omit
--target
, the--static-root-path /
argument works fine. I'm not sure why they conflict in this way.This is the root cause of rust-lang/docs.rs#422.
This is similar but not the same as #62940.
cc @QuietMisdreavus @pietroalbini
The text was updated successfully, but these errors were encountered: