Skip to content

Commit

Permalink
change separator from . to -
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-m1 committed Nov 9, 2017
1 parent 7a6832d commit 0e5c95e
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 24 deletions.
7 changes: 5 additions & 2 deletions src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_mir/util/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
4 changes: 2 additions & 2 deletions src/test/mir-opt/end_region_5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn foo<F>(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;
Expand All @@ -78,4 +78,4 @@ fn foo<F>(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
4 changes: 2 additions & 2 deletions src/test/mir-opt/end_region_6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn foo<F>(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;
// ...
Expand All @@ -82,4 +82,4 @@ fn foo<F>(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
4 changes: 2 additions & 2 deletions src/test/mir-opt/end_region_7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn foo<F>(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;
// ...
Expand All @@ -94,4 +94,4 @@ fn foo<F>(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
4 changes: 2 additions & 2 deletions src/test/mir-opt/end_region_8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn foo<F>(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;
Expand All @@ -84,4 +84,4 @@ fn foo<F>(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
4 changes: 2 additions & 2 deletions src/test/mir-opt/nll/named-lifetimes-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions src/test/mir-opt/validate_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() -> () {
// ...
Expand All @@ -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: {
Expand All @@ -76,4 +76,4 @@ fn main() {
// return;
// }
// }
// END rustc.main.{{closure}}.EraseRegions.after.mir
// END rustc.main-{{closure}}.EraseRegions.after.mir
8 changes: 4 additions & 4 deletions src/test/mir-opt/validate_4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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) -> () {
// ...
Expand All @@ -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: {
Expand All @@ -86,4 +86,4 @@ fn main() {
// }
// ...
// }
// END rustc.main.{{closure}}.EraseRegions.after.mir
// END rustc.main-{{closure}}.EraseRegions.after.mir
4 changes: 2 additions & 2 deletions src/test/mir-opt/validate_5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -63,4 +63,4 @@ fn main() {
// }
// ...
// }
// END rustc.main.{{closure}}.EraseRegions.after.mir
// END rustc.main-{{closure}}.EraseRegions.after.mir

0 comments on commit 0e5c95e

Please sign in to comment.