From 0e5c95ebcb039294924f3ddee921769d2b98fe8e Mon Sep 17 00:00:00 2001 From: Mikhail Modin Date: Sun, 5 Nov 2017 11:14:00 +0300 Subject: [PATCH] change separator from `.` to `-` --- src/librustc/hir/map/definitions.rs | 7 +++++-- src/librustc_mir/util/pretty.rs | 5 +++-- src/test/mir-opt/end_region_5.rs | 4 ++-- src/test/mir-opt/end_region_6.rs | 4 ++-- src/test/mir-opt/end_region_7.rs | 4 ++-- src/test/mir-opt/end_region_8.rs | 4 ++-- src/test/mir-opt/nll/named-lifetimes-basic.rs | 4 ++-- src/test/mir-opt/validate_1.rs | 8 ++++---- src/test/mir-opt/validate_4.rs | 8 ++++---- src/test/mir-opt/validate_5.rs | 4 ++-- 10 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index cdf0800a0e4e9..dfa675f2e9351 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -321,12 +321,15 @@ impl DefPath { pub fn to_filename_friendly_no_crate(&self) -> String { let mut s = String::with_capacity(self.data.len() * 16); + let mut opt_delimiter = None; for component in &self.data { + opt_delimiter.map(|d| s.push(d)); + opt_delimiter = Some('-'); if component.disambiguator == 0 { - write!(s, ".{}", component.data.as_interned_str()).unwrap(); + write!(s, "{}", component.data.as_interned_str()).unwrap(); } else { write!(s, - ".{}[{}]", + "{}[{}]", component.data.as_interned_str(), component.disambiguator) .unwrap(); diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index 546217b2e035c..0f07f1fe550cc 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -135,8 +135,9 @@ where let _ = fs::create_dir_all(&file_path); let function_name = tcx.hir.def_path_from_id(source.item_id()) - .map(|d| d.to_filename_friendly_no_crate()) .unwrap_or(format!(".node{}", source.item_id())); - let file_name = format!("rustc{}{}{}.{}.{}.mir", + .map(|d| d.to_filename_friendly_no_crate()) + .unwrap_or(format!("node{}", source.item_id())); + let file_name = format!("rustc.{}{}{}.{}.{}.mir", function_name, promotion_id, pass_num, pass_name, disambiguator); file_path.push(&file_name); let _ = fs::File::create(&file_path).and_then(|mut file| { diff --git a/src/test/mir-opt/end_region_5.rs b/src/test/mir-opt/end_region_5.rs index 2098f4453cf2a..9a3cca54ae53e 100644 --- a/src/test/mir-opt/end_region_5.rs +++ b/src/test/mir-opt/end_region_5.rs @@ -66,7 +66,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // } // END rustc.main.SimplifyCfg-qualify-consts.after.mir -// START rustc.main.{{closure}}.SimplifyCfg-qualify-consts.after.mir +// START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir // fn main::{{closure}}(_1: [closure@NodeId(18) d:&'14s D]) -> i32 { // let mut _0: i32; // let mut _2: i32; @@ -78,4 +78,4 @@ fn foo(f: F) where F: FnOnce() -> i32 { // StorageDead(_2); // return; // } -// END rustc.main.{{closure}}.SimplifyCfg-qualify-consts.after.mir +// END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_6.rs b/src/test/mir-opt/end_region_6.rs index fdfbbdc28fc66..7f0e16eaa0632 100644 --- a/src/test/mir-opt/end_region_6.rs +++ b/src/test/mir-opt/end_region_6.rs @@ -64,7 +64,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // } // END rustc.main.SimplifyCfg-qualify-consts.after.mir -// START rustc.main.{{closure}}.SimplifyCfg-qualify-consts.after.mir +// START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir // fn main::{{closure}}(_1: [closure@NodeId(22) d:&'19s D]) -> i32 { // let mut _0: i32; // ... @@ -82,4 +82,4 @@ fn foo(f: F) where F: FnOnce() -> i32 { // StorageDead(_2); // return; // } -// END rustc.main.{{closure}}.SimplifyCfg-qualify-consts.after.mir +// END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_7.rs b/src/test/mir-opt/end_region_7.rs index 9260d0d9d0db0..7a17afee3e035 100644 --- a/src/test/mir-opt/end_region_7.rs +++ b/src/test/mir-opt/end_region_7.rs @@ -72,7 +72,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // } // END rustc.main.SimplifyCfg-qualify-consts.after.mir -// START rustc.main.{{closure}}.SimplifyCfg-qualify-consts.after.mir +// START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir // fn main::{{closure}}(_1: [closure@NodeId(22) d:D]) -> i32 { // let mut _0: i32; // ... @@ -94,4 +94,4 @@ fn foo(f: F) where F: FnOnce() -> i32 { // return; // } // } -// END rustc.main.{{closure}}.SimplifyCfg-qualify-consts.after.mir +// END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_8.rs b/src/test/mir-opt/end_region_8.rs index cb3713915bd49..1df3099510261 100644 --- a/src/test/mir-opt/end_region_8.rs +++ b/src/test/mir-opt/end_region_8.rs @@ -71,7 +71,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // } // END rustc.main.SimplifyCfg-qualify-consts.after.mir -// START rustc.main.{{closure}}.SimplifyCfg-qualify-consts.after.mir +// START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir // fn main::{{closure}}(_1: [closure@NodeId(22) r:&'21_1rs D]) -> i32 { // let mut _0: i32; // let mut _2: i32; @@ -84,4 +84,4 @@ fn foo(f: F) where F: FnOnce() -> i32 { // return; // } // } -// END rustc.main.{{closure}}.SimplifyCfg-qualify-consts.after.mir +// END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/nll/named-lifetimes-basic.rs b/src/test/mir-opt/nll/named-lifetimes-basic.rs index c4f3a6fea5353..e3f67d817f3c2 100644 --- a/src/test/mir-opt/nll/named-lifetimes-basic.rs +++ b/src/test/mir-opt/nll/named-lifetimes-basic.rs @@ -25,10 +25,10 @@ fn main() { } // END RUST SOURCE -// START rustc.node4.nll.0.mir +// START rustc.use_x.nll.0.mir // | '_#0r: {bb0[0], bb0[1], '_#0r} // | '_#1r: {bb0[0], bb0[1], '_#0r, '_#1r} // | '_#2r: {bb0[0], bb0[1], '_#2r} // ... // fn use_x(_1: &'_#0r mut i32, _2: &'_#1r u32, _3: &'_#0r u32, _4: &'_#2r u32) -> bool { -// END rustc.node4.nll.0.mir +// END rustc.use_x.nll.0.mir diff --git a/src/test/mir-opt/validate_1.rs b/src/test/mir-opt/validate_1.rs index 3d71c5daba316..f4d1caa6a9553 100644 --- a/src/test/mir-opt/validate_1.rs +++ b/src/test/mir-opt/validate_1.rs @@ -28,13 +28,13 @@ fn main() { } // END RUST SOURCE -// START rustc.{{impl}}.foo.EraseRegions.after.mir +// START rustc.{{impl}}-foo.EraseRegions.after.mir // bb0: { // Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:5) => validate_1[317d]::{{impl}}[0]::foo[0] }, BrAnon(0)) Test, _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:5) => validate_1[317d]::{{impl}}[0]::foo[0] }, BrAnon(1)) mut i32]); // ... // return; // } -// END rustc.{{impl}}.foo.EraseRegions.after.mir +// END rustc.{{impl}}-foo.EraseRegions.after.mir // START rustc.main.EraseRegions.after.mir // fn main() -> () { // ... @@ -58,7 +58,7 @@ fn main() { // } // } // END rustc.main.EraseRegions.after.mir -// START rustc.main.{{closure}}.EraseRegions.after.mir +// START rustc.main-{{closure}}.EraseRegions.after.mir // fn main::{{closure}}(_1: &ReErased [closure@NodeId(50)], _2: &ReErased mut i32) -> i32 { // ... // bb0: { @@ -76,4 +76,4 @@ fn main() { // return; // } // } -// END rustc.main.{{closure}}.EraseRegions.after.mir +// END rustc.main-{{closure}}.EraseRegions.after.mir diff --git a/src/test/mir-opt/validate_4.rs b/src/test/mir-opt/validate_4.rs index 2ea4867b40182..80224ddc58668 100644 --- a/src/test/mir-opt/validate_4.rs +++ b/src/test/mir-opt/validate_4.rs @@ -47,7 +47,7 @@ fn main() { // } // } // END rustc.write_42.EraseRegions.after.mir -// START rustc.write_42.{{closure}}.EraseRegions.after.mir +// START rustc.write_42-{{closure}}.EraseRegions.after.mir // fn write_42::{{closure}}(_1: &ReErased [closure@NodeId(22)], _2: *mut i32) -> () { // ... // bb0: { @@ -57,7 +57,7 @@ fn main() { // return; // } // } -// END rustc.write_42.{{closure}}.EraseRegions.after.mir +// END rustc.write_42-{{closure}}.EraseRegions.after.mir // START rustc.test.EraseRegions.after.mir // fn test(_1: &ReErased mut i32) -> () { // ... @@ -74,7 +74,7 @@ fn main() { // } // } // END rustc.test.EraseRegions.after.mir -// START rustc.main.{{closure}}.EraseRegions.after.mir +// START rustc.main-{{closure}}.EraseRegions.after.mir // fn main::{{closure}}(_1: &ReErased [closure@NodeId(60)], _2: &ReErased mut i32) -> bool { // ... // bb0: { @@ -86,4 +86,4 @@ fn main() { // } // ... // } -// END rustc.main.{{closure}}.EraseRegions.after.mir +// END rustc.main-{{closure}}.EraseRegions.after.mir diff --git a/src/test/mir-opt/validate_5.rs b/src/test/mir-opt/validate_5.rs index 24b4d2099b324..a945b7dbc5fa8 100644 --- a/src/test/mir-opt/validate_5.rs +++ b/src/test/mir-opt/validate_5.rs @@ -45,7 +45,7 @@ fn main() { // ... // } // END rustc.test.EraseRegions.after.mir -// START rustc.main.{{closure}}.EraseRegions.after.mir +// START rustc.main-{{closure}}.EraseRegions.after.mir // fn main::{{closure}}(_1: &ReErased [closure@NodeId(46)], _2: &ReErased mut i32) -> bool { // ... // bb0: { @@ -63,4 +63,4 @@ fn main() { // } // ... // } -// END rustc.main.{{closure}}.EraseRegions.after.mir +// END rustc.main-{{closure}}.EraseRegions.after.mir