1
Fork 0

Fix crash with -Zdump-mir-dataflow

As of #133155 `Formatter:new` uses `as_results_cursor` to create a
non-mutable results reference, and then later that is accessed via
`deref_mut` which results in a runtime abort. Changing to
`as_results_cursor_mut` fixes it.

Fixes #133641.
This commit is contained in:
Nicholas Nethercote 2024-11-29 07:00:42 +11:00
parent 5e1440ae51
commit d37ed10634
3 changed files with 5 additions and 5 deletions

View file

@ -47,11 +47,11 @@ where
{
pub(crate) fn new(
body: &'mir Body<'tcx>,
results: &'mir Results<'tcx, A>,
results: &'mir mut Results<'tcx, A>,
style: OutputStyle,
) -> Self {
let reachable = mir::traversal::reachable_as_bitset(body);
Formatter { cursor: results.as_results_cursor(body).into(), style, reachable }
Formatter { cursor: results.as_results_cursor_mut(body).into(), style, reachable }
}
fn body(&self) -> &'mir Body<'tcx> {