From 71aae4ffa5a8ee36f09953d1b85c7b5c2818e0c6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 28 Aug 2019 09:15:31 +0200 Subject: [PATCH 1/2] test that build scripts do not run in Miri --- test-cargo-miri/Cargo.toml | 1 + test-cargo-miri/build.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test-cargo-miri/build.rs diff --git a/test-cargo-miri/Cargo.toml b/test-cargo-miri/Cargo.toml index 3abb437049..c2460014b6 100644 --- a/test-cargo-miri/Cargo.toml +++ b/test-cargo-miri/Cargo.toml @@ -3,6 +3,7 @@ name = "cargo-miri-test" version = "0.1.0" authors = ["Oliver Schneider "] edition = "2018" +build = "build.rs" [dependencies] byteorder = "1.0" diff --git a/test-cargo-miri/build.rs b/test-cargo-miri/build.rs new file mode 100644 index 0000000000..950fc3c82b --- /dev/null +++ b/test-cargo-miri/build.rs @@ -0,0 +1,15 @@ +#![feature(asm)] + +fn not_in_miri() -> i32 { + // Inline assembly definitely does not work in Miri. + let dummy = 42; + unsafe { + asm!("" : : "r"(&dummy)); + } + return dummy; +} + +fn main() { + not_in_miri(); + println!("cargo:rerun-if-changed=build.rs"); +} From 7faa329f11d38da611e49c82c823a35758a713e5 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 28 Aug 2019 09:27:19 +0200 Subject: [PATCH 2/2] more implicit --- Cargo.toml | 1 - test-cargo-miri/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d78ce46f0f..ecc8deedf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ license = "MIT/Apache-2.0" name = "miri" repository = "https://github.com/rust-lang/miri" version = "0.1.0" -build = "build.rs" default-run = "miri" edition = "2018" diff --git a/test-cargo-miri/Cargo.toml b/test-cargo-miri/Cargo.toml index c2460014b6..3abb437049 100644 --- a/test-cargo-miri/Cargo.toml +++ b/test-cargo-miri/Cargo.toml @@ -3,7 +3,6 @@ name = "cargo-miri-test" version = "0.1.0" authors = ["Oliver Schneider "] edition = "2018" -build = "build.rs" [dependencies] byteorder = "1.0"