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