]> git.lizzy.rs Git - rust.git/commitdiff
rustc_mir: do not treat NEEDS_DROP as unexpected in qualify_consts.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Wed, 6 Feb 2019 16:11:48 +0000 (18:11 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Thu, 14 Feb 2019 11:36:51 +0000 (13:36 +0200)
src/librustc_mir/transform/qualify_consts.rs

index 25d201c3452d9be8af2142f32834760f944c9189..960146651cfdd8361efa31cd54d0d0cea44ef7bc 100644 (file)
@@ -48,11 +48,6 @@ struct Qualif: u8 {
         // Refers to temporaries which cannot be promoted as
         // promote_consts decided they weren't simple enough.
         const NOT_PROMOTABLE    = 1 << 3;
-
-        // Const items can only have MUTABLE_INTERIOR
-        // and NOT_PROMOTABLE without producing an error.
-        const CONST_ERROR       = !Qualif::MUTABLE_INTERIOR.bits &
-                                  !Qualif::NOT_PROMOTABLE.bits;
     }
 }
 
@@ -419,13 +414,13 @@ fn qualify_call(
         };
 
         // Bail out on oon-`const fn` calls or if the callee had errors.
-        if !is_const_fn || self.qualify_operand(callee).intersects(Qualif::CONST_ERROR) {
+        if !is_const_fn || self.qualify_operand(callee).intersects(Qualif::NOT_CONST) {
             return Qualif::NOT_CONST;
         }
 
         // Bail out if any arguments had errors.
         for arg in args {
-            if self.qualify_operand(arg).intersects(Qualif::CONST_ERROR) {
+            if self.qualify_operand(arg).intersects(Qualif::NOT_CONST) {
                 return Qualif::NOT_CONST;
             }
         }
@@ -668,7 +663,7 @@ fn check_const(&mut self) -> (Qualif, Lrc<BitSet<Local>>) {
 
         // Account for errors in consts by using the
         // conservative type qualification instead.
-        if qualif.intersects(Qualif::CONST_ERROR) {
+        if qualif.intersects(Qualif::NOT_CONST) {
             qualif = self.qualifier().qualify_any_value_of_ty(mir.return_ty());
         }