-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Run rustc with --cfg doc
when analyzing dependencies in cargo doc
.
#8602
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Hi! Thanks for the PR! Unfortunately I don't think this is a change we can make, because it is backwards incompatible, and some libraries will fail with this change. Unfortunately, I don't have a very clear alternative for your issue. It may be possible to use |
I don't understand how this change would be backwards incompatible. The same crate gets passed to rustc and then to rustdoc, so if the presence of Is it possible to give an example of a crate that would be broken (e.g. from a Crater run), or even a code snippet of something non-pathological that would be broken by this change? |
When rustdoc processes a crate, it doesn't do a full compilation like
Generally, any circumstance where #[cfg(any(windows, doc))]
/// Hello!
pub fn foo() {
some_windows_only_crate::foo();
} And you try to do |
Would it be OK to run |
No, I don't think so. Some of the situations fail only when querying the rmeta information, so cargo wouldn't necessarily know which dependencies need to be rebuilt. That would also impose a large cost on all users when there are normal errors unrelated to this. |
Hmm, that's frustrating, but I think I understand the compat issues now. Is there any chance this might be available as a Cargo option (CLI flag, manifest field, env var...) or should I just try to find a different macro layout that Cargo can handle? |
Probably not. You can accomplish that today with |
Proposed fix for #8601
This is my first PR to Cargo and I am not familiar with the codebase. If this isn't implemented properly, please tell me and I'd be happy to make changes.