about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2017-08-16 12:36:58 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2017-08-16 16:08:39 +0200
commit8738a087ffc25f621237ca944538ef0f9b476fbc (patch)
tree7da0d1b1ee29ec126c1a26d2d2e85e389ba7adbd
parent6d6280e00c302ee24730027ba36c7aabc7094cbd (diff)
downloadrust-8738a087ffc25f621237ca944538ef0f9b476fbc.tar.gz
rust-8738a087ffc25f621237ca944538ef0f9b476fbc.zip
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.
-rw-r--r--src/librustc_driver/driver.rs10
1 files changed, 9 insertions, 1 deletions
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);