File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
src/cargo/core/compiler/build_context Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -773,6 +773,19 @@ impl RustDocFingerprint {
773
773
)
774
774
}
775
775
776
+ fn remove_doc_dirs ( doc_dirs : & Vec < PathBuf > ) -> CargoResult < ( ) > {
777
+ let errs: Vec < CargoResult < ( ) > > = doc_dirs
778
+ . iter ( )
779
+ . map ( |path| paths:: remove_dir_all ( & path) )
780
+ . filter ( |res| res. is_err ( ) )
781
+ . collect ( ) ;
782
+ if !errs. is_empty ( ) {
783
+ Err ( anyhow:: anyhow!( "Dir removal error" ) )
784
+ } else {
785
+ Ok ( ( ) )
786
+ }
787
+ }
788
+
776
789
/// This function checks whether the latest version of `Rustc` used to compile this
777
790
/// `Workspace`'s docs was the same as the one is currently being used in this `cargo doc`
778
791
/// call.
@@ -804,9 +817,7 @@ impl RustDocFingerprint {
804
817
// Check if rustc_version matches the one we just used. Otherways,
805
818
// remove the `doc` folder to trigger a re-compilation of the docs.
806
819
if fingerprint. rustc_vv != actual_rustdoc_target_data. rustc_vv {
807
- doc_dirs
808
- . iter ( )
809
- . try_for_each ( |path| paths:: remove_dir_all ( & path) ) ?;
820
+ Self :: remove_doc_dirs ( & doc_dirs) ?;
810
821
actual_rustdoc_target_data. write ( cx) ?
811
822
}
812
823
}
@@ -816,9 +827,7 @@ impl RustDocFingerprint {
816
827
// exists neither, we simply do nothing and continue.
817
828
Err ( _) => {
818
829
// We don't care if this suceeds as explained above.
819
- let _ = doc_dirs
820
- . iter ( )
821
- . try_for_each ( |path| paths:: remove_dir_all ( & path) ) ;
830
+ let _ = Self :: remove_doc_dirs ( & doc_dirs) ;
822
831
actual_rustdoc_target_data. write ( cx) ?
823
832
}
824
833
}
Original file line number Diff line number Diff line change @@ -1723,6 +1723,7 @@ LLVM version: 9.0
1723
1723
) ;
1724
1724
}
1725
1725
1726
+ #[ cfg( target_os = "linux" ) ]
1726
1727
#[ cargo_test]
1727
1728
fn doc_fingerprint_respects_target_paths ( ) {
1728
1729
// Random rustc verbose version
You can’t perform that action at this time.
0 commit comments