From 8398c1352a80a736244158b88ca61f0928e16fa0 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 31 Aug 2019 09:30:10 +0200 Subject: [PATCH 1/2] Minimal miri support Should address https://github.com/rust-lang/miri/issues/932 --- crates/std_detect/src/detect/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/std_detect/src/detect/mod.rs b/crates/std_detect/src/detect/mod.rs index f446e88eed..70a50820b3 100644 --- a/crates/std_detect/src/detect/mod.rs +++ b/crates/std_detect/src/detect/mod.rs @@ -64,7 +64,10 @@ mod bit; mod cache; cfg_if! { - if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + if #[cfg(miri)] { + #[path = "os/other.rs"] + mod os; + } else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { // On x86/x86_64 no OS specific functionality is required. #[path = "os/x86.rs"] mod os; From 196c15129c033e30f2ec0fe87d6b2f620f5a007c Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 31 Aug 2019 14:55:21 +0200 Subject: [PATCH 2/2] Document how miri support works Co-Authored-By: gnzlbg --- crates/std_detect/src/detect/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/std_detect/src/detect/mod.rs b/crates/std_detect/src/detect/mod.rs index 70a50820b3..80207daad8 100644 --- a/crates/std_detect/src/detect/mod.rs +++ b/crates/std_detect/src/detect/mod.rs @@ -65,6 +65,11 @@ mod cache; cfg_if! { if #[cfg(miri)] { + // When running under miri all target-features that are not enabled at + // compile-time are reported as disabled at run-time. + // + // For features for which `cfg(target_feature)` returns true, + // this run-time detection logic is never called. #[path = "os/other.rs"] mod os; } else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {