Skip to content

Commit 832d641

Browse files
authored
Rollup merge of #136452 - RalfJung:miri-sync, r=RalfJung
Miri subtree update r? `@ghost` Unblocks rust-lang/rust#122408 from the Miri side
2 parents 585b572 + 1c797a2 commit 832d641

Some content is hidden

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

60 files changed

+1347
-545
lines changed

Cargo.lock

+81-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ test = false # we have no unit tests
1818
doctest = false # and no doc tests
1919

2020
[dependencies]
21-
getrandom = { version = "0.2", features = ["std"] }
22-
rand = "0.8"
21+
getrandom = { version = "0.3", features = ["std"] }
22+
rand = "0.9"
2323
smallvec = { version = "1.7", features = ["drain_filter"] }
2424
aes = { version = "0.8.3", features = ["hazmat"] }
2525
measureme = "11"
@@ -47,8 +47,8 @@ windows-sys = { version = "0.52", features = [
4747
] }
4848

4949
[dev-dependencies]
50+
ui_test = "0.28.0"
5051
colored = "2"
51-
ui_test = "0.26.5"
5252
rustc_version = "0.4"
5353
regex = "1.5.5"
5454
tempfile = "3"

ci/ci.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ function endgroup {
1414
begingroup "Building Miri"
1515

1616
# Global configuration
17-
# We are getting some odd linker warnings on macOS, make sure they do not fail the build.
18-
# (See <https://github.com/rust-lang/rust/issues/136086>.)
19-
export RUSTFLAGS="-D warnings -A linker-messages"
17+
export RUSTFLAGS="-D warnings"
2018
export CARGO_INCREMENTAL=0
2119
export CARGO_EXTRA_FLAGS="--locked"
2220

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2f0ad2a71e4a4528bb80bcb24bf8fa4e50cb87c2
1+
6dd75f0d6802f56564f5f9c947a85ded286d3986

src/alloc_addresses/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
217217
// We have to pick a fresh address.
218218
// Leave some space to the previous allocation, to give it some chance to be less aligned.
219219
// We ensure that `(global_state.next_base_addr + slack) % 16` is uniformly distributed.
220-
let slack = rng.gen_range(0..16);
220+
let slack = rng.random_range(0..16);
221221
// From next_base_addr + slack, round up to adjust for alignment.
222222
let base_addr = global_state
223223
.next_base_addr

src/alloc_addresses/reuse_pool.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl ReusePool {
5858
// We don't remember stack addresses: there's a lot of them (so the perf impact is big),
5959
// and we only want to reuse stack slots within the same thread or else we'll add a lot of
6060
// undesired synchronization.
61-
if kind == MemoryKind::Stack || !rng.gen_bool(self.address_reuse_rate) {
61+
if kind == MemoryKind::Stack || !rng.random_bool(self.address_reuse_rate) {
6262
return;
6363
}
6464
let clock = clock();
@@ -88,10 +88,10 @@ impl ReusePool {
8888
thread: ThreadId,
8989
) -> Option<(u64, Option<VClock>)> {
9090
// Determine whether we'll even attempt a reuse. As above, we don't do reuse for stack addresses.
91-
if kind == MemoryKind::Stack || !rng.gen_bool(self.address_reuse_rate) {
91+
if kind == MemoryKind::Stack || !rng.random_bool(self.address_reuse_rate) {
9292
return None;
9393
}
94-
let cross_thread_reuse = rng.gen_bool(self.address_reuse_cross_thread_rate);
94+
let cross_thread_reuse = rng.random_bool(self.address_reuse_cross_thread_rate);
9595
// Determine the pool to take this from.
9696
let subpool = self.subpool(align);
9797
// Let's see if we can find something of the right size. We want to find the full range of
@@ -118,7 +118,7 @@ impl ReusePool {
118118
return None;
119119
}
120120
// Pick a random element with the desired size.
121-
let idx = rng.gen_range(begin..end);
121+
let idx = rng.random_range(begin..end);
122122
// Remove it from the pool and return.
123123
let (chosen_addr, chosen_size, chosen_thread, clock) = subpool.remove(idx);
124124
debug_assert!(chosen_size >= size && chosen_addr % align.bytes() == 0);

src/bin/miri.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,8 @@ fn main() {
721721

722722
// Ensure we have parallelism for many-seeds mode.
723723
if many_seeds.is_some() && !rustc_args.iter().any(|arg| arg.starts_with("-Zthreads=")) {
724-
// Clamp to 8 threads; things get a lot less efficient beyond that due to lock contention.
725-
let threads = std::thread::available_parallelism().map_or(1, |n| n.get()).min(8);
724+
// Clamp to 10 threads; things get a lot less efficient beyond that due to lock contention.
725+
let threads = std::thread::available_parallelism().map_or(1, |n| n.get()).min(10);
726726
rustc_args.push(format!("-Zthreads={threads}"));
727727
}
728728
let many_seeds =

src/borrow_tracker/stacked_borrows/mod.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
865865
let this = self.eval_context_mut();
866866
let new_perm = NewPermission::from_ref_ty(val.layout.ty, kind, this);
867867
let cause = match kind {
868-
RetagKind::TwoPhase { .. } => RetagCause::TwoPhase,
868+
RetagKind::TwoPhase => RetagCause::TwoPhase,
869869
RetagKind::FnEntry => unreachable!(),
870870
RetagKind::Raw | RetagKind::Default => RetagCause::Normal,
871871
};
@@ -880,7 +880,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
880880
let this = self.eval_context_mut();
881881
let retag_fields = this.machine.borrow_tracker.as_mut().unwrap().get_mut().retag_fields;
882882
let retag_cause = match kind {
883-
RetagKind::TwoPhase { .. } => unreachable!(), // can only happen in `retag_ptr_value`
883+
RetagKind::TwoPhase => unreachable!(), // can only happen in `retag_ptr_value`
884884
RetagKind::FnEntry => RetagCause::FnEntry,
885885
RetagKind::Default | RetagKind::Raw => RetagCause::Normal,
886886
};
@@ -904,10 +904,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
904904
new_perm: NewPermission,
905905
) -> InterpResult<'tcx> {
906906
let val = self.ecx.read_immediate(&self.ecx.place_to_op(place)?)?;
907-
let val = self.ecx.sb_retag_reference(&val, new_perm, RetagInfo {
908-
cause: self.retag_cause,
909-
in_field: self.in_field,
910-
})?;
907+
let val = self.ecx.sb_retag_reference(
908+
&val,
909+
new_perm,
910+
RetagInfo { cause: self.retag_cause, in_field: self.in_field },
911+
)?;
911912
self.ecx.write_immediate(*val, place)?;
912913
interp_ok(())
913914
}
@@ -996,10 +997,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
996997
access: Some(AccessKind::Write),
997998
protector: Some(ProtectorKind::StrongProtector),
998999
};
999-
this.sb_retag_place(place, new_perm, RetagInfo {
1000-
cause: RetagCause::InPlaceFnPassing,
1001-
in_field: false,
1002-
})
1000+
this.sb_retag_place(
1001+
place,
1002+
new_perm,
1003+
RetagInfo { cause: RetagCause::InPlaceFnPassing, in_field: false },
1004+
)
10031005
}
10041006

10051007
/// Mark the given tag as exposed. It was found on a pointer with the given AllocId.

src/borrow_tracker/tree_borrows/perms.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,18 @@ pub mod diagnostics {
379379
use super::*;
380380
impl fmt::Display for PermissionPriv {
381381
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
382-
write!(f, "{}", match self {
383-
ReservedFrz { conflicted: false } => "Reserved",
384-
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
385-
ReservedIM => "Reserved (interior mutable)",
386-
Active => "Active",
387-
Frozen => "Frozen",
388-
Disabled => "Disabled",
389-
})
382+
write!(
383+
f,
384+
"{}",
385+
match self {
386+
ReservedFrz { conflicted: false } => "Reserved",
387+
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
388+
ReservedIM => "Reserved (interior mutable)",
389+
Active => "Active",
390+
Frozen => "Frozen",
391+
Disabled => "Disabled",
392+
}
393+
)
390394
}
391395
}
392396

0 commit comments

Comments
 (0)