Skip to content

Commit 95b8e3c

Browse files
committed
docs(fingerprint): reorganize rustdoc fingerprint docs
1 parent bdb5046 commit 95b8e3c

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

src/cargo/core/compiler/build_runner/mod.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,9 @@ impl<'a, 'gctx> BuildRunner<'a, 'gctx> {
174174
self.check_collisions()?;
175175
self.compute_metadata_for_doc_units();
176176

177-
// We need to make sure that if there were any previous docs
178-
// already compiled, they were compiled with the same Rustc version that we're currently
179-
// using. Otherwise we must remove the `doc/` folder and compile again forcing a rebuild.
180-
//
181-
// This is important because the `.js`/`.html` & `.css` files that are generated by Rustc don't have
182-
// any versioning (See https://github.com/rust-lang/cargo/issues/8461).
183-
// Therefore, we can end up with weird bugs and behaviours if we mix different
184-
// versions of these files.
177+
// We need to make sure that if there were any previous docs already compiled,
178+
// they were compiled with the same Rustc version that we're currently using.
179+
// See the function doc comment for more.
185180
if self.bcx.build_config.intent.is_doc() {
186181
RustDocFingerprint::check_rustdoc_fingerprint(&self)?
187182
}

src/cargo/core/compiler/fingerprint/rustdoc.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,31 @@ use crate::CargoResult;
99
use crate::core::compiler::BuildRunner;
1010

1111
/// Structure used to deal with Rustdoc fingerprinting
12+
///
13+
/// This is important because the `.js`/`.html` & `.css` files
14+
/// that are generated by Rustc don't have any versioning yet
15+
/// (see <https://github.com/rust-lang/cargo/issues/8461>).
16+
/// Therefore, we can end up with weird bugs and behaviours
17+
/// if we mix different versions of these files.
18+
///
19+
/// We need to make sure that if there were any previous docs already compiled,
20+
/// they were compiled with the same Rustc version that we're currently using.
21+
/// Otherwise we must remove the `doc/` folder and compile again forcing a rebuild.
1222
#[derive(Debug, Serialize, Deserialize)]
1323
pub struct RustDocFingerprint {
24+
/// `rustc -vV` verbose version output.
1425
pub rustc_vv: String,
1526
}
1627

1728
impl RustDocFingerprint {
18-
/// This function checks whether the latest version of `Rustc` used to compile this
19-
/// `Workspace`'s docs was the same as the one is currently being used in this `cargo doc`
20-
/// call.
29+
/// Checks whether the latest version of rustc used to compile this workspace's docs
30+
/// was the same as the one is currently being used in this `cargo doc` call.
2131
///
22-
/// In case it's not, it takes care of removing the `doc/` folder as well as overwriting
23-
/// the rustdoc fingerprint info in order to guarantee that we won't end up with mixed
24-
/// versions of the `js/html/css` files that `rustdoc` autogenerates which do not have
25-
/// any versioning.
32+
/// In case it's not,
33+
/// it takes care of removing the `<artifact-dir>/doc/` folder
34+
/// as well as overwriting the rustdoc fingerprint info.
35+
/// This is to guarantee that we won't end up with mixed versions of the `js/html/css` files
36+
/// which `rustdoc` autogenerates without any versioning.
2637
pub fn check_rustdoc_fingerprint(build_runner: &BuildRunner<'_, '_>) -> CargoResult<()> {
2738
if build_runner
2839
.bcx

0 commit comments

Comments
 (0)