1
Fork 0

Run check_match and check_liveness when MIR is built instead of having an explicit phase for them

This commit is contained in:
Oli Scherer 2023-02-16 10:06:59 +00:00
parent 5bb58a68de
commit 334423263a
18 changed files with 321 additions and 328 deletions

View file

@ -51,6 +51,13 @@ fn mir_build(tcx: TyCtxt<'_>, def: LocalDefId) -> Body<'_> {
// of `mir_build`, so now we can steal it
let thir = thir.steal();
tcx.ensure().check_match(def);
// this must run before MIR dump, because
// "not all control paths return a value" is reported here.
//
// maybe move the check to a MIR pass?
tcx.ensure().check_liveness(def);
match thir.body_type {
thir::BodyTy::Fn(fn_sig) => construct_fn(tcx, def, &thir, expr, fn_sig),
thir::BodyTy::Const(ty) => construct_const(tcx, def, &thir, expr, ty),