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

@@ -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 {
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 {
error!("Failed to write graphviz dataflow results: {}", e);
}