]> git.lizzy.rs Git - rust.git/commitdiff
use a different filename for original and promoted MIRs
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>
Thu, 16 Jun 2016 13:52:20 +0000 (16:52 +0300)
committerAriel Ben-Yehuda <arielb1@mail.tau.ac.il>
Thu, 16 Jun 2016 13:54:20 +0000 (16:54 +0300)
src/librustc_mir/pretty.rs

index 856d6cda5af0f2cbc3addf020c1a41ff0f846e35..95769a7a50b024f2737e7983c0dd0cbd6cfd721c 100644 (file)
@@ -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));