Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miri subtree update #131727

Merged
merged 61 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
885ec88
avoid pthread_attr_t in tests
RalfJung Oct 5, 2024
58e0fba
Auto merge of #3945 - RalfJung:pthread_attr_t, r=RalfJung
bors Oct 5, 2024
35eb2da
Added rust-analyzer instructions for Helix
YohDeadfall Oct 3, 2024
6f84740
tweak the hint
RalfJung Oct 6, 2024
c5f3c60
Auto merge of #3936 - YohDeadfall:rust-analyzer-conf, r=RalfJung
bors Oct 6, 2024
bf2d46d
bump rustc_tools_util version
RalfJung Oct 7, 2024
ee491b3
Auto merge of #3949 - RalfJung:rustc_tools_util, r=RalfJung
bors Oct 7, 2024
0130edd
Fix spelling in README
JakeRoggenbuck Oct 7, 2024
4e9554d
fix behavior of release_clock()
RalfJung Oct 8, 2024
edc5c1e
Auto merge of #3951 - RalfJung:release-clock, r=RalfJung
bors Oct 8, 2024
6f854ce
epoll: test case showing too much clock sync
FrankReh Oct 9, 2024
f90c97c
explain the review bot use
RalfJung Oct 9, 2024
87058a4
Auto merge of #3955 - RalfJung:review-bot, r=RalfJung
bors Oct 9, 2024
7a9a9cb
epoll: rename blocking_epoll_callback since it is not just called aft…
RalfJung Oct 9, 2024
f64c9c6
Fixed pthread_getname_np impl for glibc
YohDeadfall Oct 8, 2024
8e8dd57
Auto merge of #3953 - YohDeadfall:glibc-thread-name, r=RalfJung
bors Oct 9, 2024
4560606
epoll: change clock to be per event
FrankReh Oct 8, 2024
5cdee07
Auto merge of #3946 - FrankReh:fix-over-synchronization-of-epoll, r=R…
bors Oct 9, 2024
f04d1f6
syscall/eventfd2: add failing test
FrankReh Oct 3, 2024
2675f14
syscall/eventfd2: add support
FrankReh Oct 3, 2024
26ce30d
Auto merge of #3937 - FrankReh:syscall-eventfd2, r=RalfJung
bors Oct 9, 2024
faf8c14
Auto merge of #3959 - JakeRoggenbuck:fix-spelling-in-readme, r=saethlin
bors Oct 10, 2024
eb76079
epoll event adding: no need to join, there's no old clock here
RalfJung Oct 10, 2024
66fda4a
Auto merge of #3961 - RalfJung:event-release-clock-join, r=RalfJung
bors Oct 10, 2024
c7bfc44
Auto merge of #3956 - RalfJung:epoll-ready-list, r=RalfJung
bors Oct 10, 2024
7e21dce
remove handle_unsupported_foreign_item helper
RalfJung Oct 8, 2024
9e2688c
remove -Zmiri-panic-on-unsupported flag
RalfJung Oct 10, 2024
e58a406
Auto merge of #3950 - RalfJung:handle_unsupported_foreign_item, r=Ral…
bors Oct 10, 2024
37698a9
Pipe minor changes: diagnostics, flag support and comments
tiif Oct 10, 2024
1df7a0f
add libc-pipe test to CI for freebsd, solarish
RalfJung Oct 10, 2024
256d63f
Auto merge of #3960 - tiif:smallchange, r=RalfJung
bors Oct 10, 2024
ccdea3e
simplify Tree Borrows write-during-2phase example
RalfJung Oct 11, 2024
2eda6a4
Auto merge of #3964 - RalfJung:write-during-2phase, r=RalfJung
bors Oct 11, 2024
56c0612
Fixed pthread get/set name for macOS
YohDeadfall Oct 9, 2024
a495a79
Fixed get thread name behavior for FreeBSD
YohDeadfall Oct 11, 2024
b2b0d24
rework threadname test for more consistency
RalfJung Oct 13, 2024
15f0242
Auto merge of #3957 - YohDeadfall:macos-thread-name, r=RalfJung
bors Oct 13, 2024
5e6170b
Preparing for merge from rustc
RalfJung Oct 14, 2024
9d579f5
Merge from rustc
RalfJung Oct 14, 2024
543d226
clippy
RalfJung Oct 14, 2024
bd8f2af
Auto merge of #3970 - RalfJung:rustup, r=RalfJung
bors Oct 14, 2024
89323bf
pthread_mutex: store mutex ID outside adressable memory, so it can be…
RalfJung Oct 12, 2024
1389bb9
pthread_rwlock: also store ID outside addressable memory
RalfJung Oct 12, 2024
17f0aed
pthread_cond: also store ID outside addressable memory
RalfJung Oct 12, 2024
8f342ed
macOS os_unfair_lock: also store ID outside addressable memory
RalfJung Oct 12, 2024
0f7d321
Windows InitOnce: also store ID outside addressable memory
RalfJung Oct 12, 2024
e3cfe45
make lazy_sync_get_data also take a closure to initialize if needed
RalfJung Oct 12, 2024
9265a6e
turns out relaxed accesses suffice here
RalfJung Oct 12, 2024
ba95d52
pick more clear names for the types
RalfJung Oct 12, 2024
d183660
Auto merge of #3966 - RalfJung:dont-trust-the-user, r=RalfJung
bors Oct 14, 2024
1412993
Avoid some needless monomorphizations
oli-obk Oct 14, 2024
d3c1036
Auto merge of #3972 - rust-lang:eager_dyn, r=RalfJung
bors Oct 14, 2024
64259a7
Added a variadic argument helper
YohDeadfall Oct 13, 2024
af98424
add test ensuring a moved mutex deadlocks
RalfJung Oct 14, 2024
2b020bf
Auto merge of #3968 - YohDeadfall:variadic-arg-helper, r=RalfJung
bors Oct 14, 2024
4e14ad6
move lazy_sync helper methods to be with InterpCx
RalfJung Oct 14, 2024
a802fd9
ensure that a macOS os_unfair_lock that is moved while being held is …
RalfJung Oct 14, 2024
b7c06b4
Auto merge of #3973 - RalfJung:os-unfair-lock, r=RalfJung
bors Oct 14, 2024
413ea99
use new check_min_arg_count helper in more places
RalfJung Oct 14, 2024
eb5ca5f
Auto merge of #3974 - RalfJung:check_min_arg_count, r=RalfJung
bors Oct 14, 2024
1f501a7
update lockfile
RalfJung Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ dependencies = [
"cargo_metadata",
"directories",
"rustc-build-sysroot",
"rustc_tools_util",
"rustc_tools_util 0.4.0",
"rustc_version",
"serde",
"serde_json",
Expand Down Expand Up @@ -552,7 +552,7 @@ dependencies = [
"parking_lot",
"quote",
"regex",
"rustc_tools_util",
"rustc_tools_util 0.3.0",
"serde",
"serde_json",
"syn 2.0.79",
Expand Down Expand Up @@ -4465,6 +4465,12 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ba09476327c4b70ccefb6180f046ef588c26a24cf5d269a9feba316eb4f029f"

[[package]]
name = "rustc_tools_util"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3316159ab19e19d1065ecc49278e87f767a9dae9fae80348d2b4d4fa4ae02d4d"

[[package]]
name = "rustc_trait_selection"
version = "0.0.0"
Expand Down
75 changes: 36 additions & 39 deletions src/tools/miri/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ process for such contributions:
This process is largely informal, and its primary goal is to more clearly communicate expectations.
Please get in touch with us if you have any questions!

### Managing the review state

Most PRs bounce back and forth between the reviewer and the author several times, so it is good to
keep track of who is expected to take the next step. We are using the `S-waiting-for-review` and
`S-waiting-for-author` labels for that. If a reviewer asked you to do some changes and you think
they are all taken care of, post a comment saying `@rustbot ready` to mark a PR as ready for the
next round of review.

## Preparing the build environment

Miri heavily relies on internal and unstable rustc interfaces to execute MIR,
Expand Down Expand Up @@ -195,48 +203,37 @@ installed (`cargo install hyperfine`).

## Configuring `rust-analyzer`

To configure `rust-analyzer` and VS Code for working on Miri, save the following
to `.vscode/settings.json` in your local Miri clone:

```json
{
"rust-analyzer.rustc.source": "discover",
"rust-analyzer.linkedProjects": [
"Cargo.toml",
"cargo-miri/Cargo.toml",
"miri-script/Cargo.toml",
],
"rust-analyzer.check.invocationLocation": "root",
"rust-analyzer.check.invocationStrategy": "once",
"rust-analyzer.check.overrideCommand": [
"env",
"MIRI_AUTO_OPS=no",
"./miri",
"clippy", // make this `check` when working with a locally built rustc
"--message-format=json",
],
// Contrary to what the name suggests, this also affects proc macros.
"rust-analyzer.cargo.buildScripts.invocationLocation": "root",
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"env",
"MIRI_AUTO_OPS=no",
"./miri",
"check",
"--message-format=json",
],
}
```
To configure `rust-analyzer` and the IDE for working on Miri, copy one of the provided
configuration files according to the instructions below. You can also set up a symbolic
link to keep the configuration in sync with our recommendations.

### Visual Studio Code

Copy [`etc/rust_analyzer_vscode.json`] to `.vscode/settings.json` in the project root directory.

[`etc/rust_analyzer_vscode.json`]: https://github.com/rust-lang/miri/blob/master/etc/rust_analyzer_vscode.json

### Helix

Copy [`etc/rust_analyzer_helix.toml`] to `.helix/languages.toml` in the project root directory.

Since working on Miri requires a custom toolchain, and Helix requires the language server
to be installed with the toolchain, you have to run `./miri toolchain -c rust-analyzer`
when installing the Miri toolchain. Alternatively, set the `RUSTUP_TOOLCHAIN` environment variable according to
[the documentation](https://rust-analyzer.github.io/manual.html#toolchain).

[`etc/rust_analyzer_helix.toml`]: https://github.com/rust-lang/miri/blob/master/etc/rust_analyzer_helix.toml

### Advanced configuration

> #### Note
>
> If you are [building Miri with a locally built rustc][], set
> `rust-analyzer.rustcSource` to the relative path from your Miri clone to the
> root `Cargo.toml` of the locally built rustc. For example, the path might look
> like `../rust/Cargo.toml`.
If you are building Miri with a locally built rustc, set
`rust-analyzer.rustcSource` to the relative path from your Miri clone to the
root `Cargo.toml` of the locally built rustc. For example, the path might look
like `../rust/Cargo.toml`. In addition to that, replace `clippy` by `check`
in the `rust-analyzer.check.overrideCommand` setting.

See the rustc-dev-guide's docs on ["Configuring `rust-analyzer` for `rustc`"][rdg-r-a]
for more information about configuring VS Code and `rust-analyzer`.
for more information about configuring the IDE and `rust-analyzer`.

[rdg-r-a]: https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc

Expand Down
7 changes: 1 addition & 6 deletions src/tools/miri/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ environment variable. We first document the most relevant and most commonly used
* `-Zmiri-compare-exchange-weak-failure-rate=<rate>` changes the failure rate of
`compare_exchange_weak` operations. The default is `0.8` (so 4 out of 5 weak ops will fail).
You can change it to any value between `0.0` and `1.0`, where `1.0` means it
will always fail and `0.0` means it will never fail. Note than setting it to
will always fail and `0.0` means it will never fail. Note that setting it to
`1.0` will likely cause hangs, since it means programs using
`compare_exchange_weak` cannot make progress.
* `-Zmiri-disable-isolation` disables host isolation. As a consequence,
Expand Down Expand Up @@ -392,11 +392,6 @@ to Miri failing to detect cases of undefined behavior in a program.
but reports to the program that it did actually write. This is useful when you
are not interested in the actual program's output, but only want to see Miri's
errors and warnings.
* `-Zmiri-panic-on-unsupported` will makes some forms of unsupported functionality,
such as FFI and unsupported syscalls, panic within the context of the emulated
application instead of raising an error within the context of Miri (and halting
execution). Note that code might not expect these operations to ever panic, so
this flag can lead to strange (mis)behavior.
* `-Zmiri-recursive-validation` is a *highly experimental* flag that makes validity checking
recurse below references.
* `-Zmiri-retag-fields[=<all|none|scalar>]` controls when Stacked Borrows retagging recurses into
Expand Down
6 changes: 3 additions & 3 deletions src/tools/miri/cargo-miri/Cargo.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4

[[package]]
name = "anyhow"
Expand Down Expand Up @@ -202,9 +202,9 @@ dependencies = [

[[package]]
name = "rustc_tools_util"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ba09476327c4b70ccefb6180f046ef588c26a24cf5d269a9feba316eb4f029f"
checksum = "3316159ab19e19d1065ecc49278e87f767a9dae9fae80348d2b4d4fa4ae02d4d"

[[package]]
name = "rustc_version"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/cargo-miri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ rustc-build-sysroot = "0.5.4"
serde = { version = "1.0.185", features = ["derive"] }

[build-dependencies]
rustc_tools_util = "0.3"
rustc_tools_util = "0.4"
8 changes: 4 additions & 4 deletions src/tools/miri/ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ case $HOST_TARGET in
# Partially supported targets (tier 2)
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
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
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX time hashmap random thread sync available-parallelism tls
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX time hashmap random thread sync available-parallelism tls
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX time hashmap random thread sync available-parallelism tls libc-pipe
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX time hashmap random thread sync available-parallelism tls libc-pipe
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap pthread --skip threadname
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
Expand Down
32 changes: 32 additions & 0 deletions src/tools/miri/etc/rust_analyzer_helix.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[language-server.rust-analyzer.config.rustc]
source = "discover"

[language-server.rust-analyzer.config]
linkedProjects = [
"Cargo.toml",
"cargo-miri/Cargo.toml",
"miri-script/Cargo.toml",
]

[language-server.rust-analyzer.config.check]
invocationLocation = "root"
invocationStrategy = "once"
overrideCommand = [
"env",
"MIRI_AUTO_OPS=no",
"./miri",
"clippy", # make this `check` when working with a locally built rustc
"--message-format=json",
]

# Contrary to what the name suggests, this also affects proc macros.
[language-server.rust-analyzer.config.buildScripts]
invocationLocation = "root"
invocationStrategy = "once"
overrideCommand = [
"env",
"MIRI_AUTO_OPS=no",
"./miri",
"check",
"--message-format=json",
]
27 changes: 27 additions & 0 deletions src/tools/miri/etc/rust_analyzer_vscode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"rust-analyzer.rustc.source": "discover",
"rust-analyzer.linkedProjects": [
"Cargo.toml",
"cargo-miri/Cargo.toml",
"miri-script/Cargo.toml",
],
"rust-analyzer.check.invocationLocation": "root",
"rust-analyzer.check.invocationStrategy": "once",
"rust-analyzer.check.overrideCommand": [
"env",
"MIRI_AUTO_OPS=no",
"./miri",
"clippy", // make this `check` when working with a locally built rustc
"--message-format=json",
],
// Contrary to what the name suggests, this also affects proc macros.
"rust-analyzer.cargo.buildScripts.invocationLocation": "root",
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"env",
"MIRI_AUTO_OPS=no",
"./miri",
"check",
"--message-format=json",
],
}
2 changes: 1 addition & 1 deletion src/tools/miri/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7067e4aee45c18cfa1c6af3bf79bd097684fb294
17a19e684cdf3ca088af8b4da6a6209d128913f4
2 changes: 1 addition & 1 deletion src/tools/miri/src/alloc_addresses/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ impl<'tcx> MiriMachine<'tcx> {
let thread = self.threads.active_thread();
global_state.reuse.add_addr(rng, addr, size, align, kind, thread, || {
if let Some(data_race) = &self.data_race {
data_race.release_clock(&self.threads).clone()
data_race.release_clock(&self.threads, |clock| clock.clone())
} else {
VClock::default()
}
Expand Down
2 changes: 0 additions & 2 deletions src/tools/miri/src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,6 @@ fn main() {
} else if arg == "-Zmiri-ignore-leaks" {
miri_config.ignore_leaks = true;
miri_config.collect_leak_backtraces = false;
} else if arg == "-Zmiri-panic-on-unsupported" {
miri_config.panic_on_unsupported = true;
} else if arg == "-Zmiri-strict-provenance" {
miri_config.provenance_mode = ProvenanceMode::Strict;
} else if arg == "-Zmiri-permissive-provenance" {
Expand Down
33 changes: 17 additions & 16 deletions src/tools/miri/src/concurrency/data_race.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,15 +828,14 @@ pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
}
}

/// Returns the `release` clock of the current thread.
/// Calls the callback with the "release" clock of the current thread.
/// Other threads can acquire this clock in the future to establish synchronization
/// with this program point.
fn release_clock<'a>(&'a self) -> Option<Ref<'a, VClock>>
where
'tcx: 'a,
{
///
/// The closure will only be invoked if data race handling is on.
fn release_clock<R>(&self, callback: impl FnOnce(&VClock) -> R) -> Option<R> {
let this = self.eval_context_ref();
Some(this.machine.data_race.as_ref()?.release_clock(&this.machine.threads))
Some(this.machine.data_race.as_ref()?.release_clock(&this.machine.threads, callback))
}

/// Acquire the given clock into the current thread, establishing synchronization with
Expand Down Expand Up @@ -1728,7 +1727,7 @@ impl GlobalState {
let current_index = self.active_thread_index(thread_mgr);

// Store the terminaion clock.
let terminaion_clock = self.release_clock(thread_mgr).clone();
let terminaion_clock = self.release_clock(thread_mgr, |clock| clock.clone());
self.thread_info.get_mut()[current_thread].termination_vector_clock =
Some(terminaion_clock);

Expand Down Expand Up @@ -1778,21 +1777,23 @@ impl GlobalState {
clocks.clock.join(clock);
}

/// Returns the `release` clock of the current thread.
/// Calls the given closure with the "release" clock of the current thread.
/// Other threads can acquire this clock in the future to establish synchronization
/// with this program point.
pub fn release_clock<'tcx>(&self, threads: &ThreadManager<'tcx>) -> Ref<'_, VClock> {
pub fn release_clock<'tcx, R>(
&self,
threads: &ThreadManager<'tcx>,
callback: impl FnOnce(&VClock) -> R,
) -> R {
let thread = threads.active_thread();
let span = threads.active_thread_ref().current_span();
// We increment the clock each time this happens, to ensure no two releases
// can be confused with each other.
let (index, mut clocks) = self.thread_state_mut(thread);
let r = callback(&clocks.clock);
// Increment the clock, so that all following events cannot be confused with anything that
// occurred before the release. Crucially, the callback is invoked on the *old* clock!
clocks.increment_clock(index, span);
drop(clocks);
// To return a read-only view, we need to release the RefCell
// and borrow it again.
let (_index, clocks) = self.thread_state(thread);
Ref::map(clocks, |c| &c.clock)

r
}

fn thread_index(&self, thread: ThreadId) -> VectorIdx {
Expand Down
30 changes: 6 additions & 24 deletions src/tools/miri/src/concurrency/init_once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::VecDeque;

use rustc_index::Idx;

use super::sync::EvalContextExtPriv as _;
use super::thread::DynUnblockCallback;
use super::vector_clock::VClock;
use crate::*;

Expand All @@ -27,22 +27,6 @@ pub(super) struct InitOnce {

impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
fn init_once_get_or_create_id(
&mut self,
lock: &MPlaceTy<'tcx>,
offset: u64,
) -> InterpResult<'tcx, InitOnceId> {
let this = self.eval_context_mut();
this.get_or_create_id(
lock,
offset,
|ecx| &mut ecx.machine.sync.init_onces,
|_| interp_ok(Default::default()),
)?
.ok_or_else(|| err_ub_format!("init_once has invalid ID"))
.into()
}

#[inline]
fn init_once_status(&mut self, id: InitOnceId) -> InitOnceStatus {
let this = self.eval_context_ref();
Expand All @@ -51,11 +35,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

/// Put the thread into the queue waiting for the initialization.
#[inline]
fn init_once_enqueue_and_block(
&mut self,
id: InitOnceId,
callback: impl UnblockCallback<'tcx> + 'tcx,
) {
fn init_once_enqueue_and_block(&mut self, id: InitOnceId, callback: DynUnblockCallback<'tcx>) {
let this = self.eval_context_mut();
let thread = this.active_thread();
let init_once = &mut this.machine.sync.init_onces[id];
Expand Down Expand Up @@ -93,7 +73,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

// Each complete happens-before the end of the wait
if let Some(data_race) = &this.machine.data_race {
init_once.clock.clone_from(&data_race.release_clock(&this.machine.threads));
data_race
.release_clock(&this.machine.threads, |clock| init_once.clock.clone_from(clock));
}

// Wake up everyone.
Expand All @@ -119,7 +100,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

// Each complete happens-before the end of the wait
if let Some(data_race) = &this.machine.data_race {
init_once.clock.clone_from(&data_race.release_clock(&this.machine.threads));
data_race
.release_clock(&this.machine.threads, |clock| init_once.clock.clone_from(clock));
}

// Wake up one waiting thread, so they can go ahead and try to init this.
Expand Down
Loading
Loading