diff --git a/src/tools/miri/Cargo.toml b/src/tools/miri/Cargo.toml index d054d9bfac13..ec1e87a5d132 100644 --- a/src/tools/miri/Cargo.toml +++ b/src/tools/miri/Cargo.toml @@ -28,7 +28,8 @@ measureme = "10.0.0" ctrlc = "3.2.5" # Copied from `compiler/rustc/Cargo.toml`. -[dependencies.jemalloc-sys] +# But only for Unix, it fails on Windows. +[target.'cfg(unix)'.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 c774961d486d..d07753d34dff 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -298,6 +298,7 @@ fn parse_comma_list(input: &str) -> Result, T::Err> { input.split(',').map(str::parse::).collect() } +#[cfg(unix)] fn jemalloc_magic() { // These magic runes are copied from // . @@ -334,6 +335,7 @@ fn jemalloc_magic() { } fn main() { + #[cfg(unix)] jemalloc_magic(); let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());