rustc_smir/rustc_internal/pretty.rs
1use std::io;
2
3use rustc_middle::ty::TyCtxt;
4
5use super::run;
6use crate::stable_mir;
7
8pub fn write_smir_pretty<'tcx, W: io::Write>(tcx: TyCtxt<'tcx>, w: &mut W) -> io::Result<()> {
9 writeln!(
10 w,
11 "// WARNING: This is highly experimental output it's intended for stable-mir developers only."
12 )?;
13 writeln!(
14 w,
15 "// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir."
16 )?;
17 let _ = run(tcx, || {
18 let items = stable_mir::all_local_items();
19 let _ = items.iter().map(|item| -> io::Result<()> { item.emit_mir(w) }).collect::<Vec<_>>();
20 });
21 Ok(())
22}