Skip to content

Commit afdbb08

Browse files
authored
Rollup merge of #134191 - willcrichton:dev, r=RalfJung,lqd
Make some types and methods related to Polonius + Miri public We have a tool, [Aquascope](https://github.com/cognitive-engineering-lab/aquascope/), which uses Polonius and Miri to visualize the compile-time and run-time semantics of a Rust program. Changes in the last few months to both APIs have hidden away details we depend upon. This PR re-exposes some of those details, specifically: **Polonius:** - `BorrowSet` and `BorrowData` are added to `rustc_borrowck::consumers`, and their fields are made `pub` instead of `pub(crate)`. We need this to interpret the `BorrowIndex`es generated by Polonius. - `BorrowSet::build` is now `pub`. We need this because the borrowck API doesn't provide access to the `BorrowSet` constructed during checking. - `PoloniusRegionVid` is added to `rustc_borrowck::consumers`. We need this because it's also contained in the Polonius facts. **Miri:** - `InterpCx::local_to_op` is now a special case of `local_at_frame_to_op`, which allows querying locals in any frame. We need this because we walk the whole stack at each step to collect the state of memory. - `InterpCx::layout_of_local` is now `pub`. We need this because we need to know the layout of every local at each step. If these changes go against some design goal for keeping certain types private, please let me know so we can hash out a better solution. Additionally, if there's a better way to document that it's important that certain types stay public, also let me know. For example, `BorrowSet` was previously public but was hidden in 6676cec, breaking our build. cc ```@RalfJung``` ```@nnethercote``` ```@gavinleroy```
2 parents 79b80e8 + bc7269d commit afdbb08

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/machine.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,8 +1571,12 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
15711571
res
15721572
}
15731573

1574-
fn after_local_read(ecx: &InterpCx<'tcx, Self>, local: mir::Local) -> InterpResult<'tcx> {
1575-
if let Some(data_race) = &ecx.frame().extra.data_race {
1574+
fn after_local_read(
1575+
ecx: &InterpCx<'tcx, Self>,
1576+
frame: &Frame<'tcx, Provenance, FrameExtra<'tcx>>,
1577+
local: mir::Local,
1578+
) -> InterpResult<'tcx> {
1579+
if let Some(data_race) = &frame.extra.data_race {
15761580
data_race.local_read(local, &ecx.machine);
15771581
}
15781582
interp_ok(())

0 commit comments

Comments
 (0)