Skip to content

Commit 86be22e

Browse files
committed
add crate name to mir dumps
1 parent 0dd362e commit 86be22e

File tree

270 files changed

+167
-157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+167
-157
lines changed

fuckyou.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Dir.glob('src/test/mir-opt/**/*.rs').each do |f|
2+
puts f
3+
t = File.read(f)
4+
b = File.basename(f, ".rs")
5+
t.gsub!(/\/\/ EMIT_MIR rustc/, "// EMIT_MIR " + b)
6+
File.open(f, "w") { |f| f.puts t }
7+
end

omg.mir

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// EMIT_MIR rustc.OMG
2+
test 123

src/librustc_mir/util/pretty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ fn dump_path(
177177
let mut file_path = PathBuf::new();
178178
file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir));
179179

180+
let crate_name = tcx.crate_name(source.def_id().krate);
180181
let item_name = tcx.def_path(source.def_id()).to_filename_friendly_no_crate();
181182
// All drop shims have the same DefId, so we have to add the type
182183
// to get unique file names.
@@ -196,7 +197,7 @@ fn dump_path(
196197
};
197198

198199
let file_name = format!(
199-
"rustc.{}{}{}{}.{}.{}.{}",
200+
"{}.{}{}{}{}.{}.{}.{}", crate_name,
200201
item_name, shim_disambiguator, promotion_id, pass_num, pass_name, disambiguator, extension,
201202
);
202203

src/test/mir-opt/address-of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// EMIT_MIR rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
1+
// EMIT_MIR address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
22

33
fn address_of_reborrow() {
44
let y = &[0; 10];
@@ -37,7 +37,7 @@ fn address_of_reborrow() {
3737
}
3838

3939
// The normal borrows here should be preserved
40-
// EMIT_MIR rustc.borrow_and_cast.SimplifyCfg-initial.after.mir
40+
// EMIT_MIR address_of.borrow_and_cast.SimplifyCfg-initial.after.mir
4141
fn borrow_and_cast(mut x: i32) {
4242
let p = &x as *const i32;
4343
let q = &mut x as *const i32;

src/test/mir-opt/array-index-is-temporary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ unsafe fn foo(z: *mut usize) -> u32 {
88
}
99

1010
// EMIT_MIR_FOR_EACH_BIT_WIDTH
11-
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
11+
// EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
1212
fn main() {
1313
let mut x = [42, 43, 44];
1414
let mut y = 1;

src/test/mir-opt/basic_assignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// this tests move up progration, which is not yet implemented
22

3-
// EMIT_MIR rustc.main.SimplifyCfg-initial.after.mir
3+
// EMIT_MIR basic_assignment.main.SimplifyCfg-initial.after.mir
44

55
// Check codegen for assignments (`a = b`) where the left-hand-side is
66
// not yet initialized. Assignments tend to be absent in simple code,

0 commit comments

Comments
 (0)