]> git.lizzy.rs Git - rust.git/commitdiff
Manually inline trivial function
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 12 Dec 2018 08:34:57 +0000 (09:34 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 12 Dec 2018 08:34:57 +0000 (09:34 +0100)
src/librustc_mir/transform/qualify_consts.rs

index 2caeba6c06a3173918b328043d05e8bf421e972a..37d5e9dca36955b82e7bab862ac7f7b8ac34ec2b 100644 (file)
@@ -243,7 +243,7 @@ fn assign(&mut self, dest: &Place<'tcx>, location: Location) {
             return;
         }
 
-        if self.const_let_allowed() {
+        if self.tcx.features().const_let {
             let mut dest = dest;
             let index = loop {
                 match dest {
@@ -320,10 +320,6 @@ fn assign(&mut self, dest: &Place<'tcx>, location: Location) {
         }
     }
 
-    fn const_let_allowed(&self) -> bool {
-        self.tcx.features().const_let
-    }
-
     /// Qualify a whole const, static initializer or const fn.
     fn qualify_const(&mut self) -> (Qualif, Lrc<BitSet<Local>>) {
         debug!("qualifying {} {:?}", self.mode, self.def_id);
@@ -361,7 +357,7 @@ fn qualify_const(&mut self) -> (Qualif, Lrc<BitSet<Local>>) {
                 TerminatorKind::FalseUnwind { .. } => None,
 
                 TerminatorKind::Return => {
-                    if !self.const_let_allowed() {
+                    if !self.tcx.features().const_let {
                         // Check for unused values. This usually means
                         // there are extra statements in the AST.
                         for temp in mir.temps_iter() {
@@ -468,7 +464,7 @@ fn visit_local(&mut self,
             LocalKind::ReturnPointer => {
                 self.not_const();
             }
-            LocalKind::Var if !self.const_let_allowed() => {
+            LocalKind::Var if !self.tcx.features().const_let => {
                 if self.mode != Mode::Fn {
                     emit_feature_err(&self.tcx.sess.parse_sess, "const_let",
                                     self.span, GateIssue::Language,
@@ -561,7 +557,7 @@ fn visit_place(&mut self,
                                 this.not_const()
                             } else {
                                 // just make sure this doesn't get promoted
-                                this.qualif.add(Qualif::NOT_CONST);
+                                this.add(Qualif::NOT_CONST);
                             }
                             let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx);
                             match this.mode {
@@ -1168,7 +1164,7 @@ fn visit_assign(&mut self,
         if let (Mode::ConstFn, &Place::Local(index)) = (self.mode, dest) {
             if self.mir.local_kind(index) == LocalKind::Var &&
                self.const_fn_arg_vars.insert(index) &&
-               !self.const_let_allowed() {
+               !self.tcx.features().const_let {
                 // Direct use of an argument is permitted.
                 match *rvalue {
                     Rvalue::Use(Operand::Copy(Place::Local(local))) |