Skip to content
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

Fix rebuild issues with rustdoc. #9419

Merged
merged 2 commits into from
Apr 27, 2021
Merged

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Apr 27, 2021

This fixes two issues related to rebuilds with rustdoc:

  • Switching features when running cargo doc would result in Cargo not rebuilding the documentation. This is because it was keeping the fingerprints in separate directories based on the features used. However, the rustdoc output isn't keyed off the metadata hash, so although the old fingerprint seemed "up to date", in reality the documentation was rewritten and needs to be rebuilt. The solution is to use a simplified hash for the fingerprint directory name.
  • Removing items does not remove the files from the doc directory. This changes it to clear the package's doc directory before running rustdoc, to ensure any stale files are removed.

I'm a little concerned about potential performance impact of running remove_dir_all, but I think it shouldn't be too bad?

Fixes #7370

@rust-highfive
Copy link

r? @alexcrichton

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 27, 2021
@alexcrichton
Copy link
Member

@bors: r+

Nah this seems reasonable to me, and if the perf is off we could always try to improve it later!

@bors
Copy link
Contributor

bors commented Apr 27, 2021

📌 Commit 44c549e has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 27, 2021
@bors
Copy link
Contributor

bors commented Apr 27, 2021

⌛ Testing commit 44c549e with merge 4369396...

@bors
Copy link
Contributor

bors commented Apr 27, 2021

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing 4369396 to master...

@bors bors merged commit 4369396 into rust-lang:master Apr 27, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 27, 2021
Update cargo

5 commits in 0ed318d182e465cd66071b91ac3d265af63ef8a1..4369396ce7d270972955d876eaa4954bea56bcd9
2021-04-23 20:54:54 +0000 to 2021-04-27 14:35:53 +0000
- Fix rebuild issues with rustdoc. (rust-lang/cargo#9419)
- Always use full metadata hash for -C metadata. (rust-lang/cargo#9418)
- Expose build.target .cargo/config setting as packages.target in Cargo.toml (rust-lang/cargo#9030)
- Some changes to rustdoc fingerprint checking. (rust-lang/cargo#9404)
- Document that CARGO_PKG_ are availble to build.rs (rust-lang/cargo#9405)
bors added a commit that referenced this pull request Apr 29, 2021
Fix collision doc tests randomly failing.

This fixes some tests that were randomly failing on CI. The cause is that #9419 added a remove_dir_all on the `doc` directory. However, if two jobs are trying to write to that directory at the same time, this can cause errors.  The failure rate is low (a little over 1%), and I was unable to reproduce locally (only on GitHub's CI and only on the Windows job).

The solution is to run the jobs with -j1 so they run serially.

 I only saw errors for `collision_doc_sources`, but to be on the safe side I added j1 to similar tests.
@ehuss ehuss added this to the 1.53.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing '--all-features' flag to 'cargo doc' does not trigger rebuild
4 participants