From 3e66914fc8e2289f0df9b1fbf8009d127f65839b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 31 Aug 2023 16:52:58 +0200 Subject: [PATCH 1/5] update target support section --- src/tools/miri/README.md | 28 +++++++++---------- src/tools/miri/ci.sh | 2 +- .../tests/pass/function_calls/abi_compat.rs | 7 ++--- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 06fe668354ac2..cedc558ebb87f 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -156,7 +156,7 @@ program, no matter your host OS. This is particularly useful if you are using Windows, as the Linux target is much better supported than Windows targets. You can also use this to test platforms with different properties than your host -platform. For example `cargo miri test --target mips64-unknown-linux-gnuabi64` +platform. For example `cargo miri test --target s390x-unknown-linux-gnu` will run your test suite on a big-endian target, which is useful for testing endian-sensitive code. @@ -220,20 +220,18 @@ using `--target`! The following targets are tested on CI and thus should always work (to the degree documented below): -- The best-supported target is `x86_64-unknown-linux-gnu`. Miri releases are - blocked on things working with this target. Most other Linux targets should - also work well; we do run the test suite on `i686-unknown-linux-gnu` as a - 32bit target and `mips64-unknown-linux-gnuabi64` as a big-endian target, as - well as the ARM targets `aarch64-unknown-linux-gnu` and - `arm-unknown-linux-gnueabi`. -- `x86_64-apple-darwin` should work basically as well as Linux. We also test - `aarch64-apple-darwin`. However, we might ship Miri with a nightly even when - some features on these targets regress. -- `x86_64-pc-windows-msvc` works, but supports fewer features than the Linux and - Apple targets. For example, file system access and concurrency are not - supported on Windows. We also test `i686-pc-windows-msvc`, with the same - reduced feature set. We might ship Miri with a nightly even when some features - on these targets regress. +- All Rust [Tier 1 targets](https://doc.rust-lang.org/rustc/platform-support.html) are supported by + Miri. They are all checked on Miri's CI, and some (at least one per OS) are even checked on every + Rust PR, so the shipped Miri should always work on these targets. +- We also support `s390x-unknown-linux-gnu` as our "big-endian target of choice". +- For every other target with OS `linux`, `macos`, or `windows`, Miri should generally work, but we + make no promises. +- For targets on other operating systems, even basic operations such as printing to the standard + output might not work, and Miri might fail before even reaching the `main` function. + +However, even for targets that we do support, the degree of support for accessing platform APIs +(such as the file system) differs between targets: generally, Linux targets have the best support, +and macOS targets are usually on par. Windows is supported less well. ### Running tests in parallel diff --git a/src/tools/miri/ci.sh b/src/tools/miri/ci.sh index a3fc68e6758ae..9e7779e3513d9 100755 --- a/src/tools/miri/ci.sh +++ b/src/tools/miri/ci.sh @@ -116,7 +116,7 @@ case $HOST_TARGET in MIRI_TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std # JSON target file ;; x86_64-apple-darwin) - MIRI_TEST_TARGET=mips64-unknown-linux-gnuabi64 run_tests # big-endian architecture + MIRI_TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests ;; i686-pc-windows-msvc) diff --git a/src/tools/miri/tests/pass/function_calls/abi_compat.rs b/src/tools/miri/tests/pass/function_calls/abi_compat.rs index dc1e1f0ba8d6c..01f4be70af228 100644 --- a/src/tools/miri/tests/pass/function_calls/abi_compat.rs +++ b/src/tools/miri/tests/pass/function_calls/abi_compat.rs @@ -83,9 +83,6 @@ fn main() { test_abi_newtype(0u32); test_abi_newtype(0f32); test_abi_newtype((0u32, 1u32, 2u32)); - // FIXME: skipping the array tests on mips64 due to https://github.com/rust-lang/rust/issues/115404 - if !cfg!(target_arch = "mips64") { - test_abi_newtype([0u32, 1u32, 2u32]); - test_abi_newtype([0i32; 0]); - } + test_abi_newtype([0u32, 1u32, 2u32]); + test_abi_newtype([0i32; 0]); } From fd92d956c8629eefbf9c3e299fc235d1aae2fa30 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 31 Aug 2023 17:01:47 +0200 Subject: [PATCH 2/5] don't ignore sign for ABI check --- src/tools/miri/tests/pass/function_calls/abi_compat.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/tools/miri/tests/pass/function_calls/abi_compat.rs b/src/tools/miri/tests/pass/function_calls/abi_compat.rs index 01f4be70af228..60baf8e72e80d 100644 --- a/src/tools/miri/tests/pass/function_calls/abi_compat.rs +++ b/src/tools/miri/tests/pass/function_calls/abi_compat.rs @@ -1,7 +1,5 @@ -#![feature(portable_simd)] use std::mem; use std::num; -use std::simd; #[derive(Copy, Clone)] struct Zst; @@ -56,8 +54,7 @@ fn test_abi_newtype(t: T) { fn main() { // Here we check: - // - unsigned vs signed integer is allowed - // - u32/i32 vs char is allowed + // - u32 vs char is allowed // - u32 vs NonZeroU32/Option is allowed // - reference vs raw pointer is allowed // - references to things of the same size and alignment are allowed @@ -65,10 +62,7 @@ fn main() { // these would be stably guaranteed. Code that relies on this is equivalent to code that relies // on the layout of `repr(Rust)` types. They are also fragile: the same mismatches in the fields // of a struct (even with `repr(C)`) will not always be accepted by Miri. - test_abi_compat(0u32, 0i32); - test_abi_compat(simd::u32x8::splat(1), simd::i32x8::splat(1)); test_abi_compat(0u32, 'x'); - test_abi_compat(0i32, 'x'); test_abi_compat(42u32, num::NonZeroU32::new(1).unwrap()); test_abi_compat(0u32, Some(num::NonZeroU32::new(1).unwrap())); test_abi_compat(&0u32, &0u32 as *const u32); From f28772f968a4bea1484376f6baf7daa39778cf5e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 1 Sep 2023 08:30:31 +0200 Subject: [PATCH 3/5] add '--skip-children' to rustfmt invocation --- src/tools/miri/miri-script/src/commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/miri-script/src/commands.rs b/src/tools/miri/miri-script/src/commands.rs index 2948219ad8945..b7031d9a3ee22 100644 --- a/src/tools/miri/miri-script/src/commands.rs +++ b/src/tools/miri/miri-script/src/commands.rs @@ -510,7 +510,7 @@ impl Command { let mut cmd = cmd!( e.sh, - "rustfmt +{toolchain} --edition=2021 --config-path {config_path} {flags...}" + "rustfmt +{toolchain} --edition=2021 --config-path {config_path} --unstable-features --skip-children {flags...}" ); eprintln!("$ {cmd} ..."); From d2923a44389bb43ccdfd0849fc5af713954817ed Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Sep 2023 03:02:47 +0200 Subject: [PATCH 4/5] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index f173cc37e8536..919bc135fdff4 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -dca2d1ff00bf96d244b1bb9a2117a92ec50ac71d +35e416303e6591a71ef6a91e006c602d2def3968 From dc81d6c2827bb23e75f1dc6c42e9c705ed976ba1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 3 Sep 2023 09:28:30 +0200 Subject: [PATCH 5/5] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 919bc135fdff4..b40e7f83f4f4a 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -35e416303e6591a71ef6a91e006c602d2def3968 +a989e25f1b87949a886eab3da10324d14189fe95