introduce PrettyPrintMirOptions for cosmetic MIR dump options

initially starting with `-Z mir-include-spans` because we want them in
the NLL mir dump pass
This commit is contained in:
Rémy Rakic 2024-08-28 13:54:32 +00:00
parent 8a26d21ce2
commit 0fba9b4dbb

View File

@ -44,8 +44,9 @@ pub(crate) fn codegen_fn<'tcx>(
let _mir_guard = crate::PrintOnPanic(|| {
let mut buf = Vec::new();
with_no_trimmed_paths!({
rustc_middle::mir::pretty::write_mir_fn(tcx, mir, &mut |_, _| Ok(()), &mut buf)
.unwrap();
use rustc_middle::mir::pretty;
let options = pretty::PrettyPrintMirOptions::from_cli(tcx);
pretty::write_mir_fn(tcx, mir, &mut |_, _| Ok(()), &mut buf, options).unwrap();
});
String::from_utf8_lossy(&buf).into_owned()
});