diff --git a/src/librustc_mir/pretty.rs b/src/librustc_mir/pretty.rs index 856d6cda5af..95769a7a50b 100644 --- a/src/librustc_mir/pretty.rs +++ b/src/librustc_mir/pretty.rs @@ -61,8 +61,13 @@ pub fn dump_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return; } - let file_name = format!("rustc.node{}.{}.{}.mir", - node_id, pass_name, disambiguator); + let promotion_id = match src { + MirSource::Promoted(_, id) => format!("-promoted{}", id), + _ => String::new() + }; + + let file_name = format!("rustc.node{}{}.{}.{}.mir", + node_id, promotion_id, pass_name, disambiguator); let _ = fs::File::create(&file_name).and_then(|mut file| { try!(writeln!(file, "// MIR for `{}`", node_path)); try!(writeln!(file, "// node_id = {}", node_id));