bootstrap: doc: document std crates one by one#157143
bootstrap: doc: document std crates one by one#157143Fabian-Gruenbichler wants to merge 1 commit into
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
fe86a47 to
c67b1f5
Compare
|
force-pushed with clippy fix |
| cargo | ||
| .arg("--no-deps") | ||
| .arg("--target-dir") | ||
| .arg(&*target_dir.to_string_lossy()) |
There was a problem hiding this comment.
It's preexisting, but I think we should be able to just pass target_dir here? Cargo::arg should take Path/OsStr.
| Kind::Doc, | ||
| ); | ||
| let mut crates = requested_crates.to_vec(); | ||
| let std_lib_crate_order = STD_PUBLIC_CRATES |
There was a problem hiding this comment.
yes, but it seems it is still required to document things in the right order. I am happy to fix this another way, but I haven't yet found a simple reproducer that allows me to figure out what takes a wrong turn where. if somebody has a clue, I am happy to take a closer look there :)
|
I'm a bit hesistant on papering over this in bootstrap 🤔 Is there any particular combo that makes it more likely to trigger this? EDIT: ah, the discussion on the issue also points to rust-lang/cargo#8487. Also not super sure on the tradeoffs. Do we know if using this approach can bring back other problems? |
|
my reproducer was simply running |
|
Is there a way to override the order without documenting the crates one by one? Sure would be nice to fix this in Cargo than to add yet another hack to bootstrap :) |
|
AFAIK/AFAICT cargo already tries to pick the right order, but somehow still sometimes takes a wrong turn. I tried manually reproducing it with a workspace and crates referencing eachother, but failed to do so. I think the way bootstrap calls |
|
Since you have been digging into this, have you tried diffing whether the current invocation vs documenting crates one by one actually produces the same output? In other words, is documenting everything together only sometimes non-deterministic, or does it also produce something different than setting a specific doc build order? |
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
c67b1f5 to
94bc438
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
the html output looks identical, modulo references (both to docs.rs and doc.rust-lang.org instead of relative local ones) and settings.html/help.html mentioning a different "current crate" ( wdiff for the html files attached, this is with this PR (just rebased/force-pushed) compared to |
| .enumerate() | ||
| .map(|(i, v)| (v.to_string(), i)) | ||
| .collect::<HashMap<_, _>>(); | ||
| crates.sort_by_key(|c| std_lib_crate_order.get(c).unwrap_or(&usize::MAX)); |
There was a problem hiding this comment.
This is potentially non-deterministic, we should sort by a tuple (crate order [number], crate name).
| if builder.config.library_docs_private_items { | ||
| cargo.rustdocflag("--document-private-items").rustdocflag("--document-hidden-items"); | ||
| } | ||
| compile::std_cargo(builder, target, &mut cargo, std::slice::from_ref(&krate)); |
There was a problem hiding this comment.
| compile::std_cargo(builder, target, &mut cargo, std::slice::from_ref(&krate)); | |
| compile::std_cargo(builder, target, &mut cargo, &[krate]); |
|
Would passing I think if it does fix this I'd be OK taking a patch that sets it; maybe in the future we could gate that on something like |
that's the first thing I tried on the Debian side - we call and things are still unreproducible: https://reproduce.debian.net/all/forky.html#rust-doc but I just saw that there are two more |
Since switching over from individual, per crate
cargo rustdocinvocations to a singlecargo docinvocation for all crates, the doc output forStdbecame racy. Dependencies betweenlibrary/workspace crates were handled in a flaky fashion, sometimes being emitted as relative references, sometimes as references to the html root.This is probably only a workaround, and it should actually be fixed in cargo or rustdoc, but I haven't managed to reproduce this issue outside of the Std doc build via bootstrap.
Closes: #156567
Fixes: 58e18dd