Skip to content

Commit ad6dd60

Browse files
committed
fix Stacked Borrows interaction with dyn*
1 parent 57056d7 commit ad6dd60

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/tools/miri/src/helpers.rs

+4
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
478478
} else if matches!(v.layout.fields, FieldsShape::Union(..)) {
479479
// A (non-frozen) union. We fall back to whatever the type says.
480480
(self.unsafe_cell_action)(v)
481+
} else if matches!(v.layout.ty.kind(), ty::Dynamic(_, _, ty::DynStar)) {
482+
// This needs to read the vtable pointer to proceed type-driven, but we don't
483+
// want to reentrantly read from memory here.
484+
(self.unsafe_cell_action)(v)
481485
} else {
482486
// We want to not actually read from memory for this visit. So, before
483487
// walking this value, we have to make sure it is not a

src/tools/miri/tests/pass/dyn-star.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Dyn* handling leads to some funky reentrancy in Stacked Borrows, for some reason
2-
//@compile-flags: -Zmiri-disable-stacked-borrows
31
#![feature(dyn_star)]
42
#![allow(incomplete_features)]
53

0 commit comments

Comments
 (0)