Skip to content

Commit e78f91c

Browse files
committed
Refactor doc_dirs obtention
We should try to avoid dealing with paths ourseleves. Now the access/parsing and construction is handled via `Layout`.
1 parent 7bfb3d0 commit e78f91c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/cargo/core/compiler/build_context/target_info.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ impl RustDocFingerprint {
773773
)
774774
}
775775

776-
fn remove_doc_dirs(doc_dirs: &Vec<PathBuf>) -> CargoResult<()> {
776+
fn remove_doc_dirs(doc_dirs: &Vec<&Path>) -> CargoResult<()> {
777777
let errs: Vec<CargoResult<()>> = doc_dirs
778778
.iter()
779779
.map(|path| paths::remove_dir_all(&path))
@@ -800,15 +800,11 @@ impl RustDocFingerprint {
800800
};
801801

802802
// Collect all of the target doc paths for which the docs need to be compiled for.
803-
let doc_dirs: Vec<PathBuf> = cx
804-
.compilation
805-
.root_output
803+
let doc_dirs: Vec<&Path> = cx
804+
.bcx
805+
.all_kinds
806806
.iter()
807-
.map(|(ck, _)| match ck {
808-
CompileKind::Host => cx.files().host_root().to_path_buf(),
809-
CompileKind::Target(t) => cx.files().host_root().join(Path::new(t.rustc_target())),
810-
})
811-
.map(|path| path.join("doc"))
807+
.map(|kind| cx.files().layout(*kind).doc())
812808
.collect();
813809

814810
// Check wether `.rustdoc_fingerprint.json` exists

0 commit comments

Comments
 (0)