Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b669931

Browse files
authored
Rollup merge of rust-lang#139065 - RalfJung:miri-sync, r=RalfJung
Miri subtree update r? `@ghost`
2 parents 52aed95 + 7310925 commit b669931

File tree

25 files changed

+233
-94
lines changed

25 files changed

+233
-94
lines changed

Cargo.lock

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ dependencies = [
535535
"termize",
536536
"tokio",
537537
"toml 0.7.8",
538-
"ui_test 0.29.2",
538+
"ui_test",
539539
"walkdir",
540540
]
541541

@@ -2262,7 +2262,7 @@ dependencies = [
22622262
"smallvec",
22632263
"tempfile",
22642264
"tikv-jemalloc-sys",
2265-
"ui_test 0.28.0",
2265+
"ui_test",
22662266
"windows-sys 0.52.0",
22672267
]
22682268

@@ -5508,32 +5508,6 @@ version = "0.1.7"
55085508
source = "registry+https://github.com/rust-lang/crates.io-index"
55095509
checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
55105510

5511-
[[package]]
5512-
name = "ui_test"
5513-
version = "0.28.0"
5514-
source = "registry+https://github.com/rust-lang/crates.io-index"
5515-
checksum = "7484683d60d50ca1d1b6433c3dbf6c5ad71d20387acdcfb16fe79573f3fba576"
5516-
dependencies = [
5517-
"annotate-snippets 0.11.5",
5518-
"anyhow",
5519-
"bstr",
5520-
"cargo-platform",
5521-
"cargo_metadata 0.18.1",
5522-
"color-eyre",
5523-
"colored",
5524-
"comma",
5525-
"crossbeam-channel",
5526-
"indicatif",
5527-
"levenshtein",
5528-
"prettydiff",
5529-
"regex",
5530-
"rustc_version",
5531-
"rustfix",
5532-
"serde",
5533-
"serde_json",
5534-
"spanned",
5535-
]
5536-
55375511
[[package]]
55385512
name = "ui_test"
55395513
version = "0.29.2"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- name: Build the sysroots
1818
run: |
19+
rustup toolchain install nightly
1920
cargo install -f rustup-toolchain-install-master
2021
./miri toolchain -c rust-docs # Docs are the only place targets are separated by tier
2122
./miri install

src/tools/miri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,9 +1079,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
10791079

10801080
[[package]]
10811081
name = "ui_test"
1082-
version = "0.28.0"
1082+
version = "0.29.1"
10831083
source = "registry+https://github.com/rust-lang/crates.io-index"
1084-
checksum = "7484683d60d50ca1d1b6433c3dbf6c5ad71d20387acdcfb16fe79573f3fba576"
1084+
checksum = "14bf63f2931a28a04af0bd24c5f850223d29f3a40afae49ed6ce442a65eb8652"
10851085
dependencies = [
10861086
"annotate-snippets",
10871087
"anyhow",

src/tools/miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ windows-sys = { version = "0.52", features = [
4747
] }
4848

4949
[dev-dependencies]
50-
ui_test = "0.28.0"
50+
ui_test = "0.29.1"
5151
colored = "2"
5252
rustc_version = "0.4"
5353
regex = "1.5.5"

src/tools/miri/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ inherent interpreter slowdown and a loss of parallelism.
237237
You can get your test suite's parallelism back by running `cargo miri nextest run -jN`
238238
(note that you will need [`cargo-nextest`](https://nexte.st) installed).
239239
This works because `cargo-nextest` collects a list of all tests then launches a
240-
separate `cargo miri run` for each test. You will need to specify a `-j` or `--test-threads`;
241-
by default `cargo miri nextest run` runs one test at a time. For more details, see the
240+
separate `cargo miri run` for each test. For more information about nextest, see the
242241
[`cargo-nextest` Miri documentation](https://nexte.st/book/miri.html).
243242

244243
Note: This one-test-per-process model means that `cargo miri test` is able to detect data
@@ -432,7 +431,8 @@ to Miri failing to detect cases of undefined behavior in a program.
432431
* `-Zmiri-track-weak-memory-loads` shows a backtrace when weak memory emulation returns an outdated
433432
value from a load. This can help diagnose problems that disappear under
434433
`-Zmiri-disable-weak-memory-emulation`.
435-
* `-Zmiri-tree-borrows` replaces [Stacked Borrows] with the [Tree Borrows] rules.
434+
* <a name="-Zmiri-tree-borrows"><!-- The playground links here --></a>
435+
`-Zmiri-tree-borrows` replaces [Stacked Borrows] with the [Tree Borrows] rules.
436436
Tree Borrows is even more experimental than Stacked Borrows. While Tree Borrows
437437
is still sound in the sense of catching all aliasing violations that current versions
438438
of the compiler might exploit, it is likely that the eventual final aliasing model

src/tools/miri/bench-cargo-miri/mse/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn main() {
1010
}
1111

1212
fn read_i16(buffer: &[u8], index: usize) -> i16 {
13-
const SIZE: usize = std::mem::size_of::<i16>();
13+
const SIZE: usize = size_of::<i16>();
1414
let mut bytes: [u8; SIZE] = [0u8; SIZE];
1515
bytes.copy_from_slice(&buffer[(index * SIZE)..(index * SIZE + SIZE)]);
1616
unsafe { std::mem::transmute(bytes) }

src/tools/miri/cargo-miri/src/phases.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ pub fn phase_rustc(mut args: impl Iterator<Item = String>, phase: RustcPhase) {
467467
if let Some(i) = val.iter().position(|&s| s == "link") {
468468
emit_link_hack = true;
469469
val.remove(i);
470-
if !val.iter().any(|&s| s == "metadata") {
470+
if !val.contains(&"metadata") {
471471
val.push("metadata");
472472
}
473473
}

src/tools/miri/ci/ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ case $HOST_TARGET in
166166
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
167167
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe
168168
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe
169-
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random sync threadname pthread epoll eventfd
169+
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random sync concurrency thread epoll eventfd
170170
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
171171
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
172172
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std

src/tools/miri/rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f5729cfed3c45e061e8a443677fc1d5ef9277df7
1+
4ac032f857b46037b55c1fc0fa702450aad37f43

src/tools/miri/src/alloc_addresses/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,22 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
170170
// This ensures the interpreted program and native code have the same view of memory.
171171
let base_ptr = match info.kind {
172172
AllocKind::LiveData => {
173-
if this.tcx.try_get_global_alloc(alloc_id).is_some() {
173+
if memory_kind == MiriMemoryKind::Global.into() {
174174
// For new global allocations, we always pre-allocate the memory to be able use the machine address directly.
175175
let prepared_bytes = MiriAllocBytes::zeroed(info.size, info.align)
176176
.unwrap_or_else(|| {
177177
panic!("Miri ran out of memory: cannot create allocation of {size:?} bytes", size = info.size)
178178
});
179179
let ptr = prepared_bytes.as_ptr();
180-
// Store prepared allocation space to be picked up for use later.
180+
// Store prepared allocation to be picked up for use later.
181181
global_state
182182
.prepared_alloc_bytes
183183
.try_insert(alloc_id, prepared_bytes)
184184
.unwrap();
185185
ptr
186186
} else {
187+
// Non-global allocations are already in memory at this point so
188+
// we can just get a pointer to where their data is stored.
187189
this.get_alloc_bytes_unchecked_raw(alloc_id)?
188190
}
189191
}
@@ -381,6 +383,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
381383
align: Align,
382384
) -> InterpResult<'tcx, MiriAllocBytes> {
383385
let this = self.eval_context_ref();
386+
assert!(this.tcx.try_get_global_alloc(id).is_some());
384387
if this.machine.native_lib.is_some() {
385388
// In native lib mode, MiriAllocBytes for global allocations are handled via `prepared_alloc_bytes`.
386389
// This additional call ensures that some `MiriAllocBytes` are always prepared, just in case

0 commit comments

Comments
 (0)