-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
doc: RUSTDOCFLAGS and --target
is not passed to rustdoc when documenting proc-macros with a --target
set
#7677
Comments
Hm, I'm having a hard time trying to figure out what the best behavior would be. I don't think Cargo can always pass |
Ohhhh, that's a good point. Would it still be feasible to allow for some kind of override to attempt to cross-compile (or cross-document, in this case) a proc-macro crate? For Docs.rs's purposes, we know we're going to be building for targets that have std available, but i'm not sure if there's a way to force cargo to build all of a proc-macro crate's dependencies for a cross target. |
Well, someone did ask on Discord if we could build more targets. At the time I told them it's feasible to build any target supported by rustup, is that not the case? Why won't |
Specifically, passing |
Oh I see. I think I said that all right. Now going from there: I would expect that to behave the same as when compiling for a target that's not installed:
|
I think we're pretty unlikely to change Cargo's behavior here, but I think one possible fix for docs.rs would be to use |
This doesn't help with the biggest problem, which is that RUSTDOCFLAGS isn't passed. We can work around quirks in the output directory on our end. |
Problem
On docs.rs, we've run into an issue (rust-lang/docs.rs#422) where proc-macros were not correctly being documented because of being passed an explicit
--target
flag.Steps
cargo doc --no-deps --target x86_64-unknown-linux-gnu
(substituting your native target or some other target for which you have its std installed)Expected outcome: Documentation is available in
target/x86_64-unknown-linux-gnu/doc
.Actual outcome: Documentation is available in
target/doc
.The situation gets worse when
RUSTDOCFLAGS
is involved;cargo doc
does not pass RUSTDOCFLAGS to rustdoc when documenting a proc-macro with an explicit--target
.Possible Solution(s)
My preferred solution would be to always handle calls to rustdoc as if they were regular libraries, i.e. give them a
--target
, output them into the target-specific directory, etc. The lack of RUSTDOCFLAGS seems like a weird oversight, but given #4423 there may be some crossed wires with rustc and building things that run immediately on the host.Notes
Docs.rs always runs the latest nightly, but the logs in rust-lang/rust#66796 (comment) were collected with
cargo 1.41.0-nightly (750cb1482 2019-11-23)
.The text was updated successfully, but these errors were encountered: