Skip to content

Commit

Permalink
fix Stacked Borrows interaction with dyn*
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 20, 2023
1 parent 75bc5e6 commit 9df7fc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
} else if matches!(v.layout.fields, FieldsShape::Union(..)) {
// A (non-frozen) union. We fall back to whatever the type says.
(self.unsafe_cell_action)(v)
} else if matches!(v.layout.ty.kind(), ty::Dynamic(_, _, ty::DynStar)) {
// This needs to read the vtable pointer to proceed type-driven, but we don't
// want to reentrantly read from memory here.
(self.unsafe_cell_action)(v)
} else {
// We want to not actually read from memory for this visit. So, before
// walking this value, we have to make sure it is not a
Expand Down
2 changes: 0 additions & 2 deletions tests/pass/dyn-star.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Dyn* handling leads to some funky reentrancy in Stacked Borrows, for some reason
//@compile-flags: -Zmiri-disable-stacked-borrows
#![feature(dyn_star)]
#![allow(incomplete_features)]

Expand Down

0 comments on commit 9df7fc3

Please sign in to comment.