From 8738a087ffc25f621237ca944538ef0f9b476fbc Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 16 Aug 2017 12:36:58 +0200 Subject: [PATCH] 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. --- src/librustc_driver/driver.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 0e4fb075b9c..0c729b5a3fc 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -970,8 +970,12 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, // We compute "constant qualifications" between MIR_CONST and MIR_VALIDATED. // What we need to run borrowck etc. - passes.push_pass(MIR_CONST, mir::transform::borrow_check::BorrowckMir); + passes.push_pass(MIR_VALIDATED, mir::transform::qualify_consts::QualifyAndPromoteConstants); + + // FIXME: ariel points SimplifyBranches should run after + // mir-borrowck; otherwise code within `if false { ... }` would + // not be checked. passes.push_pass(MIR_VALIDATED, mir::transform::simplify_branches::SimplifyBranches::new("initial")); passes.push_pass(MIR_VALIDATED, mir::transform::simplify::SimplifyCfg::new("qualify-consts")); @@ -979,6 +983,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, // borrowck runs between MIR_VALIDATED and MIR_OPTIMIZED. + // FIXME: niko says this should be a query (see rustc::ty::maps) + // instead of a pass. + passes.push_pass(MIR_VALIDATED, mir::transform::borrow_check::BorrowckMir); + // These next passes must be executed together passes.push_pass(MIR_OPTIMIZED, mir::transform::no_landing_pads::NoLandingPads); passes.push_pass(MIR_OPTIMIZED, mir::transform::add_call_guards::CriticalCallEdges);