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:
parent
5e1440ae51
commit
d37ed10634
3 changed files with 5 additions and 5 deletions
|
@ -47,11 +47,11 @@ where
|
||||||
{
|
{
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
body: &'mir Body<'tcx>,
|
body: &'mir Body<'tcx>,
|
||||||
results: &'mir Results<'tcx, A>,
|
results: &'mir mut Results<'tcx, A>,
|
||||||
style: OutputStyle,
|
style: OutputStyle,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let reachable = mir::traversal::reachable_as_bitset(body);
|
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> {
|
fn body(&self) -> &'mir Body<'tcx> {
|
||||||
|
|
|
@ -281,10 +281,10 @@ pub trait Analysis<'tcx> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let results = Results { analysis: self, entry_sets };
|
let mut results = Results { analysis: self, entry_sets };
|
||||||
|
|
||||||
if tcx.sess.opts.unstable_opts.dump_mir_dataflow {
|
if tcx.sess.opts.unstable_opts.dump_mir_dataflow {
|
||||||
let res = write_graphviz_results(tcx, body, &results, pass_name);
|
let res = write_graphviz_results(tcx, body, &mut results, pass_name);
|
||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
error!("Failed to write graphviz dataflow results: {}", e);
|
error!("Failed to write graphviz dataflow results: {}", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ where
|
||||||
pub(super) fn write_graphviz_results<'tcx, A>(
|
pub(super) fn write_graphviz_results<'tcx, A>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &mir::Body<'tcx>,
|
body: &mir::Body<'tcx>,
|
||||||
results: &Results<'tcx, A>,
|
results: &mut Results<'tcx, A>,
|
||||||
pass_name: Option<&'static str>,
|
pass_name: Option<&'static str>,
|
||||||
) -> std::io::Result<()>
|
) -> std::io::Result<()>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue