about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-26 09:35:23 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-30 09:44:06 +0100
commit507ea97a3e245887bc8cbea0f0fe8474d082bd0e (patch)
tree8fb422826a94fcc30b50235044b1c5c5326590c2
parentd62bcad38da1b65ecd8a3544c3ff94855b88366a (diff)
downloadrust-507ea97a3e245887bc8cbea0f0fe8474d082bd0e.tar.gz
rust-507ea97a3e245887bc8cbea0f0fe8474d082bd0e.zip
Properly name the flag for `&&` -> `&` conversion
-rw-r--r--src/librustc/mir/mod.rs10
-rw-r--r--src/librustc_mir/build/mod.rs2
-rw-r--r--src/librustc_mir/hair/cx/expr.rs4
-rw-r--r--src/librustc_mir/hair/cx/mod.rs8
-rw-r--r--src/librustc_mir/transform/qualify_consts.rs2
5 files changed, 13 insertions, 13 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index a82a7b555a0..3968d9aece2 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -153,7 +153,7 @@ pub struct Mir<'tcx> {
     /// `||` expression into `&` or `|` respectively. This is problematic because if we ever stop
     /// this conversion from happening and use short circuiting, we will cause the following code
     /// to change the value of `x`: `let mut x = 42; false && { x = 55; true };`
-    pub const_can_have_let_mut_bindings: bool,
+    pub control_flow_destroyed: bool,
 
     /// A span representing this MIR, for error reporting
     pub span: Span,
@@ -173,7 +173,7 @@ impl<'tcx> Mir<'tcx> {
         arg_count: usize,
         upvar_decls: Vec<UpvarDecl>,
         span: Span,
-        const_can_have_let_mut_bindings: bool,
+        control_flow_destroyed: bool,
     ) -> Self {
         // We need `arg_count` locals, and one for the return place
         assert!(
@@ -198,7 +198,7 @@ impl<'tcx> Mir<'tcx> {
             spread_arg: None,
             span,
             cache: cache::Cache::new(),
-            const_can_have_let_mut_bindings,
+            control_flow_destroyed,
         }
     }
 
@@ -429,7 +429,7 @@ impl_stable_hash_for!(struct Mir<'tcx> {
     arg_count,
     upvar_decls,
     spread_arg,
-    const_can_have_let_mut_bindings,
+    control_flow_destroyed,
     span,
     cache
 });
@@ -2983,7 +2983,7 @@ BraceStructTypeFoldableImpl! {
         arg_count,
         upvar_decls,
         spread_arg,
-        const_can_have_let_mut_bindings,
+        control_flow_destroyed,
         span,
         cache,
     }
diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs
index ab19cd9dd5b..80cab0cf686 100644
--- a/src/librustc_mir/build/mod.rs
+++ b/src/librustc_mir/build/mod.rs
@@ -864,7 +864,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
             self.arg_count,
             self.upvar_decls,
             self.fn_span,
-            self.hir.const_can_have_let_mut_bindings(),
+            self.hir.control_flow_destroyed(),
         )
     }
 
diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs
index 951651aa1ce..5acff380f28 100644
--- a/src/librustc_mir/hair/cx/expr.rs
+++ b/src/librustc_mir/hair/cx/expr.rs
@@ -372,7 +372,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
                     // FIXME(eddyb) use logical ops in constants when
                     // they can handle that kind of control-flow.
                     (hir::BinOpKind::And, hir::Constness::Const) => {
-                        cx.const_can_have_let_mut_bindings = false;
+                        cx.control_flow_destroyed = true;
                         ExprKind::Binary {
                             op: BinOp::BitAnd,
                             lhs: lhs.to_ref(),
@@ -380,7 +380,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
                         }
                     }
                     (hir::BinOpKind::Or, hir::Constness::Const) => {
-                        cx.const_can_have_let_mut_bindings = false;
+                        cx.control_flow_destroyed = true;
                         ExprKind::Binary {
                             op: BinOp::BitOr,
                             lhs: lhs.to_ref(),
diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs
index 8ee1eac0e33..76dde4ed02b 100644
--- a/src/librustc_mir/hair/cx/mod.rs
+++ b/src/librustc_mir/hair/cx/mod.rs
@@ -58,7 +58,7 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
     check_overflow: bool,
 
     /// See field with the same name on `Mir`
-    const_can_have_let_mut_bindings: bool,
+    control_flow_destroyed: bool,
 }
 
 impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
@@ -99,12 +99,12 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
             constness,
             body_owner_kind,
             check_overflow,
-            const_can_have_let_mut_bindings: true,
+            control_flow_destroyed: false,
         }
     }
 
-    pub fn const_can_have_let_mut_bindings(&self) -> bool {
-        self.const_can_have_let_mut_bindings
+    pub fn control_flow_destroyed(&self) -> bool {
+        self.control_flow_destroyed
     }
 }
 
diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs
index 8eae4537664..b9c33ae8c1a 100644
--- a/src/librustc_mir/transform/qualify_consts.rs
+++ b/src/librustc_mir/transform/qualify_consts.rs
@@ -1183,7 +1183,7 @@ impl MirPass for QualifyAndPromoteConstants {
             // Do the actual promotion, now that we know what's viable.
             promote_consts::promote_candidates(mir, tcx, temps, candidates);
         } else {
-            if !mir.const_can_have_let_mut_bindings {
+            if mir.control_flow_destroyed {
                 for local in mir.mut_vars_iter() {
                     let span = mir.local_decls[local].source_info.span;
                     tcx.sess.span_err(