-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
emits spurious build errors due to unsatisfied trait bounds on code that compiles fine
#117796
Comments
You'll get the same errors if you run Whether the rustdoc change should have happened without warning is a separate discussion, but I think that should unblock you at least? |
Thank you, that is helpful for unblocking this! In the meantime I also ran searched nightlies: from nightly-2023-10-24 to nightly-2023-11-09 bisected with cargo-bisect-rustc v0.6.7Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start=2023-10-24 --end=2023-11-09 -- doc |
Sadly however, your pointer is not immediately helpful for getting Rustdoc to generate the documentation I want (it can be checked out at docs.rs) because my code relied on Rustdoc's leniency to accept documenting feature-gated items, in combination with |
It's a fair bit of duplication, but you could #[cfg(doc)]
impl<W: std::io::Write> std::io::Write for DeflateEncoder<W> so that it's implementing both EDIT: Or maybe a blanket |
These changes work around a recent change in rustdoc's behavior. The patch was suggested by @Nemo157.
Thank you, that's better! The manual The more concise blanket implementation did not work, however: For what it's worth, I believe the recent changes in Rustdoc's behavior are not very intuitive. In my experience, Rustdoc has not been prone to ICEs to the extent that would justify rejecting slightly invalid views of the code for documentation purposes. Considering how many software projects lack good documentation, it does not seem like a good idea to discourage people from documenting their code by requiring them to think harder on technical correctness when considering the interaction of Rustdoc's code view with conditional compilation. Additionally, are those Rustdoc ICEs costly to fix when they happen? Documentation is an artifact for human consumption, so it's fair for Rustdoc to accept imprecise constructions as long as what to do with them is clear. I consider my specific problem solved for now, but I'm not convinced this is the direction Rustdoc should take moving forward. |
* chore(deps): update rust crate proptest to 1.4.0 * chore: work around rust-lang/rust#117796 These changes work around a recent change in rustdoc's behavior. The patch was suggested by @Nemo157. * chore: fix test compilation under non-std --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Alejandro González <me@alegon.dev>
I tried this code: zopfli-rs/zopfli#36
I expected to see this happen: the CI build workflow completes fine.
Instead, this happened: the CI build workflow run failed to build the crate documentation. However, the crate compiles without any problems when using
cargo test
andcargo build
with the same features:I suspect there's a new issue with the latest nightly
rustdoc
, leading to unexpected trait bound errors. This suspicion stems from the fact that the same command works well underrustc 1.75.0-nightly (df871fbf0 2023-10-24)
. Additionally, there have been recent changes made to the code that rustdoc accepts: #117622, #117450Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: