diff --git a/src/tools/miri/Cargo.toml b/src/tools/miri/Cargo.toml index df987bd3ac6..3da751c69a9 100644 --- a/src/tools/miri/Cargo.toml +++ b/src/tools/miri/Cargo.toml @@ -28,8 +28,9 @@ measureme = "10.0.0" ctrlc = "3.2.5" # Copied from `compiler/rustc/Cargo.toml`. -# But only for Unix, it fails on Windows. -[target.'cfg(unix)'.dependencies.jemalloc-sys] +# But only for some targets, it fails for others. Rustc configures this in its CI, but we can't +# easily use that since we support of-tree builds. +[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies.jemalloc-sys] version = "0.5.0" features = ['unprefixed_malloc_on_supported_platforms'] diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index d07753d34df..aead55a6996 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -298,7 +298,7 @@ fn parse_comma_list(input: &str) -> Result, T::Err> { input.split(',').map(str::parse::).collect() } -#[cfg(unix)] +#[cfg(any(target_os = "linux", target_os = "macos"))] fn jemalloc_magic() { // These magic runes are copied from // . @@ -335,7 +335,7 @@ fn jemalloc_magic() { } fn main() { - #[cfg(unix)] + #[cfg(any(target_os = "linux", target_os = "macos"))] jemalloc_magic(); let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());