Skip to content

Commit 8738a08

Browse files
committed
Moved mir-borrowck pass down to where comments say it should be.
Added two fixmes: The `SimplifyBranches` pass cannot stay where it is, and `BorrowckMir` should be a query, not a pass. But I am going to leave those changes to a future PR.
1 parent 6d6280e commit 8738a08

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/librustc_driver/driver.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -970,15 +970,23 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
970970
// We compute "constant qualifications" between MIR_CONST and MIR_VALIDATED.
971971

972972
// What we need to run borrowck etc.
973-
passes.push_pass(MIR_CONST, mir::transform::borrow_check::BorrowckMir);
973+
974974
passes.push_pass(MIR_VALIDATED, mir::transform::qualify_consts::QualifyAndPromoteConstants);
975+
976+
// FIXME: ariel points SimplifyBranches should run after
977+
// mir-borrowck; otherwise code within `if false { ... }` would
978+
// not be checked.
975979
passes.push_pass(MIR_VALIDATED,
976980
mir::transform::simplify_branches::SimplifyBranches::new("initial"));
977981
passes.push_pass(MIR_VALIDATED, mir::transform::simplify::SimplifyCfg::new("qualify-consts"));
978982
passes.push_pass(MIR_VALIDATED, mir::transform::nll::NLL);
979983

980984
// borrowck runs between MIR_VALIDATED and MIR_OPTIMIZED.
981985

986+
// FIXME: niko says this should be a query (see rustc::ty::maps)
987+
// instead of a pass.
988+
passes.push_pass(MIR_VALIDATED, mir::transform::borrow_check::BorrowckMir);
989+
982990
// These next passes must be executed together
983991
passes.push_pass(MIR_OPTIMIZED, mir::transform::no_landing_pads::NoLandingPads);
984992
passes.push_pass(MIR_OPTIMIZED, mir::transform::add_call_guards::CriticalCallEdges);

0 commit comments

Comments
 (0)