@@ -9,20 +9,31 @@ use crate::CargoResult;
99use 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 ) ]
1323pub struct RustDocFingerprint {
24+ /// `rustc -vV` verbose version output.
1425 pub rustc_vv : String ,
1526}
1627
1728impl 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