about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-01-07 13:15:53 +0100
committerRalf Jung <post@ralfj.de>2024-01-07 13:15:53 +0100
commitc4a11ea93e7f0ef2b29614f695e6444b3a0866b3 (patch)
tree3d025c50003d03d1aa6e7b7f1c8508132b7d19db
parentb8209e2ef1a599c9f63199b68ee2556d4591ea97 (diff)
downloadrust-c4a11ea93e7f0ef2b29614f695e6444b3a0866b3.tar.gz
rust-c4a11ea93e7f0ef2b29614f695e6444b3a0866b3.zip
only use jemalloc on Unix
-rw-r--r--src/tools/miri/Cargo.toml3
-rw-r--r--src/tools/miri/src/bin/miri.rs2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/miri/Cargo.toml b/src/tools/miri/Cargo.toml
index d054d9bfac1..ec1e87a5d13 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 c774961d486..d07753d34df 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<T: FromStr>(input: &str) -> Result<Vec<T>, T::Err> {
     input.split(',').map(str::parse::<T>).collect()
 }
 
+#[cfg(unix)]
 fn jemalloc_magic() {
     // These magic runes are copied from
     // <https://github.com/rust-lang/rust/blob/e89bd9428f621545c979c0ec686addc6563a394e/compiler/rustc/src/main.rs#L39>.
@@ -334,6 +335,7 @@ fn jemalloc_magic() {
 }
 
 fn main() {
+    #[cfg(unix)]
     jemalloc_magic();
 
     let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());