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

Some changes to rustdoc fingerprint checking. #9404

Merged
merged 5 commits into from
Apr 26, 2021

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Apr 24, 2021

#8640 introduced a check which deletes the doc directory if cargo detects it has stale contents from a different toolchain version. Rustdoc has some shared files (js and css for example) that can get corrupted between versions. Unfortunately that caused some problems with rustbuild which does a few unusual things. Rustbuild will:

  • Create the doc directory before running cargo doc and places a .stamp file inside it.
  • Creates symlinks of the doc directory so that they can be shared across different target directories (in particular, between rustc and rustdoc).

In order to address these issues, this PR does several things:

  • Adds -Z skip-rustdoc-fingerprint to disable the doc clearing behavior.
  • Don't delete the doc directory if the rustdoc fingerprint is missing. This is intended to help with the scenario where the user creates a doc directory ahead of time with pre-existing contents before the first build. The downside is that cargo will not be able to protect against switching from pre-1.53 to post-1.53.
  • Don't delete the doc directory itself (just its contents). This should help if the user created the doc directory as a symlink to somewhere else.
  • Don't delete hidden files in the doc directory. This isn't something that rustdoc creates.

Only the -Z change is needed for rustbuild. The others I figured I'd include just to be on the safe side in case there are other users doing unusual things (and I had already written them thinking they would work for rustbuild). Hopefully the rustbuild .stamp mechanism will be enough protection there.

Fixes #9336

ehuss added 5 commits April 23, 2021 14:31
This also rearranges the code a little bit to try to avoid some
duplication and to try to make it a little more compact.
In some cases, the directory may actually be a symlink created by the
user, and we don't want to delete it. Also, skip any hidden files added
by the user as well.
This is a hidden flag intended to only be used by rustbuild which will
skip the rustdoc fingerprint check. rustbuild does some funky things
with sharing the doc directory across multiple target directories via
symlinks, and that causes problems where after building in one target
directory, then switching to the second one, it will clear the contents.
@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 24, 2021
@alexcrichton
Copy link
Member

@bors: r+

Seems fine by me!

@bors
Copy link
Contributor

bors commented Apr 26, 2021

📌 Commit c373867 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 26, 2021
@bors
Copy link
Contributor

bors commented Apr 26, 2021

⌛ Testing commit c373867 with merge a3ff382...

@bors
Copy link
Contributor

bors commented Apr 26, 2021

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

@bors bors merged commit a3ff382 into rust-lang:master Apr 26, 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)
@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.

Rustdoc fingerprinting issues
4 participants