]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/transform/qualify_consts.rs
MIR: split Operand::Consume into Copy and Move.
[rust.git] / src / librustc_mir / transform / qualify_consts.rs
index 97e80de96c5cc0d6ef119eb7c69f2d6bc90cb671..555f0a327980e101e2af07af4075a943a5bdf87d 100644 (file)
@@ -519,7 +519,8 @@ fn visit_lvalue(&mut self,
 
     fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
         match *operand {
-            Operand::Consume(ref lvalue) => {
+            Operand::Copy(ref lvalue) |
+            Operand::Move(ref lvalue) => {
                 self.nest(|this| {
                     this.super_operand(operand, location);
                     this.try_consume();
@@ -872,10 +873,14 @@ fn visit_assign(&mut self,
                self.const_fn_arg_vars.insert(index.index()) {
 
                 // Direct use of an argument is permitted.
-                if let Rvalue::Use(Operand::Consume(Lvalue::Local(local))) = *rvalue {
-                    if self.mir.local_kind(local) == LocalKind::Arg {
-                        return;
+                match *rvalue {
+                    Rvalue::Use(Operand::Copy(Lvalue::Local(local))) |
+                    Rvalue::Use(Operand::Move(Lvalue::Local(local))) => {
+                        if self.mir.local_kind(local) == LocalKind::Arg {
+                            return;
+                        }
                     }
+                    _ => {}
                 }
 
                 // Avoid a generic error for other uses of arguments.