Skip to content

Commit 18459c4

Browse files
authored
Unrolled build for rust-lang#128612
Rollup merge of rust-lang#128612 - compiler-errors:validate-mir-opt-mir, r=davidtwco Make `validate_mir` ensure the final MIR for all bodies A lot of the crashes tests use `-Zpolymorphize` or `-Zdump-mir` for their side effect of computing the `optimized_mir` for all bodies, which will uncover bugs with late MIR passes like the inliner. I don't like having all these tests depend on `-Zpolymorphize` (or other hacky ways) for no reason, so this PR extends the `-Zvalidate-mir` flag to ensure `optimized_mir`/`mir_for_ctfe` for all body owners during the analysis phase. Two thoughts: 1. This could be moved later in the compilation pipeline I guess? I don't really think it matters, though. 1. This could alternatively be expressed using a new flag, though I don't necessarily see much value in separating these. For example, rust-lang#128171 could have used this flag, in the `tests/ui/polymorphization/inline-incorrect-early-bound.rs`. r? mir
2 parents 2048386 + 470ada2 commit 18459c4

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

compiler/rustc_interface/src/passes.rs

+7
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,13 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
818818
});
819819
sess.time("layout_testing", || layout_test::test_layout(tcx));
820820
sess.time("abi_testing", || abi_test::test_abi(tcx));
821+
if tcx.sess.opts.unstable_opts.validate_mir {
822+
sess.time("ensuring_optimized_MIR_is_computable", || {
823+
tcx.hir().par_body_owners(|def_id| {
824+
tcx.instance_mir(ty::InstanceKind::Item(def_id.into()));
825+
});
826+
});
827+
}
821828
}
822829

823830
/// Runs the type-checking, region checking and other miscellaneous analysis

tests/crashes/121127.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ known-bug: #121127
2-
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes -C debuginfo=2
2+
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes -C debuginfo=2
33
// Note that as of PR#123949 this only crashes with debuginfo enabled
44

55
#![feature(specialization)]

tests/crashes/122909.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
1+
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
22
//@ known-bug: #122909
33

44

tests/crashes/126896.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ known-bug: rust-lang/rust#126896
2-
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
2+
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
33

44
#![feature(type_alias_impl_trait)]
55
type Two<'a, 'b> = impl std::fmt::Debug;

0 commit comments

Comments
 (0)