Skip to content

Commit 4da5444

Browse files
authored
chore: document why du function uses mutex
1 parent 8859998 commit 4da5444

File tree

1 file changed

+7
-0
lines changed
  • crates/cargo-util/src

1 file changed

+7
-0
lines changed

crates/cargo-util/src/du.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ fn du_inner(path: &Path, patterns: &[&str]) -> Result<u64> {
3939
.git_ignore(false)
4040
.git_exclude(false);
4141
let walker = builder.build_parallel();
42+
43+
// Platforms like PowerPC don't support AtomicU64, so we a Mutex instead.
44+
//
45+
// See:
46+
// - https://github.com/rust-lang/cargo/pull/12981
47+
// - https://github.com/rust-lang/rust/pull/117916#issuecomment-1812635848
4248
let total = Arc::new(Mutex::new(0u64));
49+
4350
// A slot used to indicate there was an error while walking.
4451
//
4552
// It is possible that more than one error happens (such as in different

0 commit comments

Comments
 (0)