summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_smir/src/rustc_internal/pretty.rs
blob: 3ef2d28ea4734d5bf2f02c372560f43c3c52b5ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::io;

use super::run;
use rustc_middle::ty::TyCtxt;

pub fn write_smir_pretty<'tcx, W: io::Write>(tcx: TyCtxt<'tcx>, w: &mut W) -> io::Result<()> {
    writeln!(
        w,
        "// WARNING: This is highly experimental output it's intended for stable-mir developers only."
    )?;
    writeln!(
        w,
        "// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir."
    )?;
    let _ = run(tcx, || {
        let items = stable_mir::all_local_items();
        let _ = items.iter().map(|item| -> io::Result<()> { item.dump(w) }).collect::<Vec<_>>();
    });
    Ok(())
}