Skip to content

Commit 9a1d156

Browse files
committed
Auto merge of rust-lang#135742 - RalfJung:miri-sync, r=RalfJung
Miri subtree update r? `@ghost`
2 parents 39dc268 + 49375c4 commit 9a1d156

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+982
-765
lines changed

src/tools/miri/.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
with:
127127
fetch-depth: 256 # get a bit more of the history
128128
- name: install josh-proxy
129-
run: RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r23.12.04
129+
run: cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
130130
- name: setup bot git name and email
131131
run: |
132132
git config --global user.name 'The Miri Cronjob Bot'

src/tools/miri/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ We use the [`josh` proxy](https://github.com/josh-project/josh) to transmit chan
290290
rustc and Miri repositories. You can install it as follows:
291291

292292
```sh
293-
RUSTFLAGS="--cap-lints=warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r23.12.04
293+
cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
294294
```
295295

296296
Josh will automatically be started and stopped by `./miri`.

src/tools/miri/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ degree documented below):
217217
- For every other target with OS `linux`, `macos`, or `windows`, Miri should generally work, but we
218218
make no promises and we don't run tests for such targets.
219219
- We have unofficial support (not maintained by the Miri team itself) for some further operating systems.
220-
- `solaris` / `illumos`: maintained by @devnexen. Supports `std::{env, thread, sync}`, but not `std::fs`.
221-
- `freebsd`: **maintainer wanted**. Supports `std::env` and parts of `std::{thread, fs}`, but not `std::sync`.
220+
- `solaris` / `illumos`: maintained by @devnexen. Supports the entire test suite.
221+
- `freebsd`: maintained by @YohDeadfall. Supports `std::env` and parts of `std::{thread, fs}`, but not `std::sync`.
222222
- `android`: **maintainer wanted**. Support very incomplete, but a basic "hello world" works.
223223
- `wasi`: **maintainer wanted**. Support very incomplete, not even standard output works, but an empty `main` function works.
224224
- For targets on other operating systems, Miri might fail before even reaching the `main` function.

src/tools/miri/ci/ci.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,14 @@ case $HOST_TARGET in
147147
# Extra tier 2
148148
TEST_TARGET=arm-unknown-linux-gnueabi run_tests
149149
TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
150+
# Not officially supported tier 2
151+
TEST_TARGET=x86_64-unknown-illumos run_tests
152+
TEST_TARGET=x86_64-pc-solaris run_tests
150153
# Partially supported targets (tier 2)
151154
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
152155
UNIX="hello panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
153156
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe
154157
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe
155-
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX time hashmap random thread sync available-parallelism tls libc-pipe fs
156-
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX time hashmap random thread sync available-parallelism tls libc-pipe fs
157158
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random sync threadname pthread epoll eventfd
158159
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
159160
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std

src/tools/miri/etc/rust_analyzer_vscode.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@
55
"cargo-miri/Cargo.toml",
66
"miri-script/Cargo.toml",
77
],
8-
"rust-analyzer.check.invocationLocation": "root",
98
"rust-analyzer.check.invocationStrategy": "once",
109
"rust-analyzer.check.overrideCommand": [
11-
"env",
12-
"MIRI_AUTO_OPS=no",
1310
"./miri",
1411
"clippy", // make this `check` when working with a locally built rustc
1512
"--message-format=json",
1613
],
14+
"rust-analyzer.cargo.extraEnv": {
15+
"MIRI_AUTO_OPS": "no",
16+
"MIRI_IN_RA": "1",
17+
},
1718
// Contrary to what the name suggests, this also affects proc macros.
18-
"rust-analyzer.cargo.buildScripts.invocationLocation": "root",
1919
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
2020
"rust-analyzer.cargo.buildScripts.overrideCommand": [
21-
"env",
22-
"MIRI_AUTO_OPS=no",
2321
"./miri",
2422
"check",
2523
"--message-format=json",

src/tools/miri/miri

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ set -e
33
# We want to call the binary directly, so we need to know where it ends up.
44
ROOT_DIR="$(dirname "$0")"
55
MIRI_SCRIPT_TARGET_DIR="$ROOT_DIR"/miri-script/target
6-
# If stdout is not a terminal and we are not on CI, assume that we are being invoked by RA, and use JSON output.
7-
if ! [ -t 1 ] && [ -z "$CI" ]; then
6+
TOOLCHAIN="+nightly"
7+
# If we are being invoked for RA, use JSON output and the default toolchain (to make proc-macros
8+
# work in RA). This needs a different target dir to avoid mixing up the builds.
9+
if [ -n "$MIRI_IN_RA" ]; then
810
MESSAGE_FORMAT="--message-format=json"
11+
TOOLCHAIN=""
12+
MIRI_SCRIPT_TARGET_DIR="$MIRI_SCRIPT_TARGET_DIR"/ra
913
fi
1014
# We need a nightly toolchain, for `-Zroot-dir`.
11-
cargo +nightly build $CARGO_EXTRA_FLAGS --manifest-path "$ROOT_DIR"/miri-script/Cargo.toml \
15+
cargo $TOOLCHAIN build $CARGO_EXTRA_FLAGS --manifest-path "$ROOT_DIR"/miri-script/Cargo.toml \
1216
-Zroot-dir="$ROOT_DIR" \
1317
-q --target-dir "$MIRI_SCRIPT_TARGET_DIR" $MESSAGE_FORMAT || \
1418
( echo "Failed to build miri-script. Is the 'nightly' toolchain installed?"; exit 1 )

src/tools/miri/miri-script/src/commands.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ impl Command {
423423
.map(|path| path.into_os_string().into_string().unwrap())
424424
.collect()
425425
} else {
426-
benches.into_iter().map(Into::into).collect()
426+
benches.into_iter().collect()
427427
};
428428
let target_flag = if let Some(target) = target {
429429
let mut flag = OsString::from("--target=");
@@ -564,6 +564,10 @@ impl Command {
564564
if bless {
565565
e.sh.set_var("RUSTC_BLESS", "Gesundheit");
566566
}
567+
if e.sh.var("MIRI_TEST_TARGET").is_ok() {
568+
// Avoid trouble due to an incorrectly set env var.
569+
bail!("MIRI_TEST_TARGET must not be set when invoking `./miri test`");
570+
}
567571
if let Some(target) = target {
568572
// Tell the harness which target to test.
569573
e.sh.set_var("MIRI_TEST_TARGET", target);

src/tools/miri/miri-script/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ pub enum Command {
111111
/// `rustup-toolchain-install-master` must be installed for this to work.
112112
Toolchain {
113113
/// Flags that are passed through to `rustup-toolchain-install-master`.
114+
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
114115
flags: Vec<String>,
115116
},
116117
/// Pull and merge Miri changes from the rustc repo.

src/tools/miri/rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13170cd787cb733ed24842ee825bcbd98dc01476
1+
01706e1a34c87656fcbfce198608f4cd2ac6461a

src/tools/miri/src/concurrency/cpu_affinity.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ impl CpuAffinityMask {
5454
let chunk = self.0[start..].first_chunk_mut::<4>().unwrap();
5555
let offset = cpu % 32;
5656
*chunk = match target.options.endian {
57-
Endian::Little => (u32::from_le_bytes(*chunk) | 1 << offset).to_le_bytes(),
58-
Endian::Big => (u32::from_be_bytes(*chunk) | 1 << offset).to_be_bytes(),
57+
Endian::Little => (u32::from_le_bytes(*chunk) | (1 << offset)).to_le_bytes(),
58+
Endian::Big => (u32::from_be_bytes(*chunk) | (1 << offset)).to_be_bytes(),
5959
};
6060
}
6161
8 => {
6262
let start = cpu / 64 * 8; // first byte of the correct u64
6363
let chunk = self.0[start..].first_chunk_mut::<8>().unwrap();
6464
let offset = cpu % 64;
6565
*chunk = match target.options.endian {
66-
Endian::Little => (u64::from_le_bytes(*chunk) | 1 << offset).to_le_bytes(),
67-
Endian::Big => (u64::from_be_bytes(*chunk) | 1 << offset).to_be_bytes(),
66+
Endian::Little => (u64::from_le_bytes(*chunk) | (1 << offset)).to_le_bytes(),
67+
Endian::Big => (u64::from_be_bytes(*chunk) | (1 << offset)).to_be_bytes(),
6868
};
6969
}
7070
other => bug!("chunk size not supported: {other}"),

0 commit comments

Comments
 (0)