Skip to content

Commit 5965158

Browse files
authored
Rollup merge of rust-lang#101428 - JakobDegen:build-tests, r=oli-obk
Add mir building test directory The first commit renames `mir-map.0` mir dumps to `built.after` dumps. I am happy to drop this commit if someone can explain the origin of the name. The second commit moves a bunch of mir building tests into their own directory. I did my best to make sure that all of these tests are actually testing mir building, and not just incidentally using `built.after` r? `@oli-obk`
2 parents a227543 + 51b0363 commit 5965158

File tree

52 files changed

+136
-112
lines changed

Some content is hidden

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

52 files changed

+136
-112
lines changed

compiler/rustc_mir_transform/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ fn mir_const<'tcx>(
288288

289289
let mut body = tcx.mir_built(def).steal();
290290

291-
rustc_middle::mir::dump_mir(tcx, None, "mir_map", &0, &body, |_, _| Ok(()));
291+
pass_manager::dump_mir_for_phase_change(tcx, &body);
292292

293293
pm::run_passes(
294294
tcx,

compiler/rustc_mir_transform/src/shim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> Body<'_> {
845845
span,
846846
);
847847

848-
rustc_middle::mir::dump_mir(tcx, None, "mir_map", &0, &body, |_, _| Ok(()));
848+
crate::pass_manager::dump_mir_for_phase_change(tcx, &body);
849849

850850
body
851851
}

src/test/mir-opt/enum_cast.bar.mir_map.0.mir renamed to src/test/mir-opt/building/enum_cast.bar.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `bar` 0 mir_map
1+
// MIR for `bar` after built
22

33
fn bar(_1: Bar) -> usize {
44
debug bar => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11

src/test/mir-opt/enum_cast.boo.mir_map.0.mir renamed to src/test/mir-opt/building/enum_cast.boo.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `boo` 0 mir_map
1+
// MIR for `boo` after built
22

33
fn boo(_1: Boo) -> usize {
44
debug boo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11

src/test/mir-opt/enum_cast.droppy.mir_map.0.mir renamed to src/test/mir-opt/building/enum_cast.droppy.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `droppy` 0 mir_map
1+
// MIR for `droppy` after built
22

33
fn droppy() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/enum_cast.rs:+0:13: +0:13

src/test/mir-opt/enum_cast.foo.mir_map.0.mir renamed to src/test/mir-opt/building/enum_cast.foo.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `foo` 0 mir_map
1+
// MIR for `foo` after built
22

33
fn foo(_1: Foo) -> usize {
44
debug foo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11

src/test/mir-opt/enum_cast.rs renamed to src/test/mir-opt/building/enum_cast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// EMIT_MIR enum_cast.foo.mir_map.0.mir
2-
// EMIT_MIR enum_cast.bar.mir_map.0.mir
3-
// EMIT_MIR enum_cast.boo.mir_map.0.mir
1+
// EMIT_MIR enum_cast.foo.built.after.mir
2+
// EMIT_MIR enum_cast.bar.built.after.mir
3+
// EMIT_MIR enum_cast.boo.built.after.mir
44

55
enum Foo {
66
A
@@ -27,7 +27,7 @@ fn boo(boo: Boo) -> usize {
2727
boo as usize
2828
}
2929

30-
// EMIT_MIR enum_cast.droppy.mir_map.0.mir
30+
// EMIT_MIR enum_cast.droppy.built.after.mir
3131
enum Droppy {
3232
A, B, C
3333
}

src/test/mir-opt/issue-101867.rs renamed to src/test/mir-opt/building/issue-101867.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// EMIT_MIR issue_101867.main.mir_map.0.mir
1+
// EMIT_MIR issue_101867.main.built.after.mir
22
fn main() {
33
let x: Option<u8> = Some(1);
44
let Some(y) = x else {

src/test/mir-opt/issue-49232.rs renamed to src/test/mir-opt/building/issue-49232.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// We must mark a variable whose initialization fails due to an
22
// abort statement as StorageDead.
33

4-
// EMIT_MIR issue_49232.main.mir_map.0.mir
4+
// EMIT_MIR issue_49232.main.built.after.mir
55
fn main() {
66
loop {
77
let beacon = {

src/test/mir-opt/issue_101867.main.mir_map.0.mir renamed to src/test/mir-opt/building/issue_101867.main.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `main` 0 mir_map
1+
// MIR for `main` after built
22

33
| User Type Annotations
44
| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option<u8>) }, span: $DIR/issue-101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8>

0 commit comments

Comments
 (0)