Github Some changes to rustdoc fingerprint checking. by ehuss · Pull Request #94...
source link: https://github.com/rust-lang/cargo/pull/9404
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
#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 runningcargo 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 thedoc
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 adoc
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 thedoc
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
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK