Skip to content

Commit 8611e52

Browse files
committed
Auto merge of #74837 - xldenis:mir-dump-crate-file, r=oli-obk
Fix #70767 This PR changes the format of MIR dump filenames to include the crate name rather than `rustc` at the start. As a result, we can now place mir-opt tests in the same directory as the source files, like with UI tests. I had to make sure that `compiletest` added a bit_width suffix to the expected files when appropriate but otherwise the change is only moving the files to the correct location and ensuring that the `EMIT_MIR` lines are correct. Fixes #70767 cc @oli-obk
2 parents 6fd4c3f + f07607f commit 8611e52

File tree

306 files changed

+225
-422
lines changed

Some content is hidden

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

306 files changed

+225
-422
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ dependencies = [
611611
"diff",
612612
"env_logger 0.7.1",
613613
"getopts",
614+
"glob",
614615
"lazy_static",
615616
"libc",
616617
"log",

src/librustc_mir/util/pretty.rs

Lines changed: 10 additions & 2 deletions
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,8 +197,15 @@ fn dump_path(
196197
};
197198

198199
let file_name = format!(
199-
"rustc.{}{}{}{}.{}.{}.{}",
200-
item_name, shim_disambiguator, promotion_id, pass_num, pass_name, disambiguator, extension,
200+
"{}.{}{}{}{}.{}.{}.{}",
201+
crate_name,
202+
item_name,
203+
shim_disambiguator,
204+
promotion_id,
205+
pass_num,
206+
pass_name,
207+
disambiguator,
208+
extension,
201209
);
202210

203211
file_path.push(&file_name);

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)