]> git.lizzy.rs Git - rust.git/commitdiff
fix `super_visit_with` for `Terminator`
authorBastian Kauschke <bastian_kauschke@hotmail.de>
Sat, 7 Nov 2020 10:54:35 +0000 (11:54 +0100)
committerBastian Kauschke <bastian_kauschke@hotmail.de>
Sat, 7 Nov 2020 10:56:31 +0000 (11:56 +0100)
compiler/rustc_middle/src/mir/type_foldable.rs

index 391bd8be7e4c59502f80a7236d37e30658d32ad4..0801188b27881c80d9c531a0d483da710e51f06a 100644 (file)
@@ -109,24 +109,21 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow
                 args.visit_with(visitor)
             }
             Assert { ref cond, ref msg, .. } => {
-                if cond.visit_with(visitor).is_break() {
-                    use AssertKind::*;
-                    match msg {
-                        BoundsCheck { ref len, ref index } => {
-                            len.visit_with(visitor)?;
-                            index.visit_with(visitor)
-                        }
-                        Overflow(_, l, r) => {
-                            l.visit_with(visitor)?;
-                            r.visit_with(visitor)
-                        }
-                        OverflowNeg(op) | DivisionByZero(op) | RemainderByZero(op) => {
-                            op.visit_with(visitor)
-                        }
-                        ResumedAfterReturn(_) | ResumedAfterPanic(_) => ControlFlow::CONTINUE,
+                cond.visit_with(visitor)?;
+                use AssertKind::*;
+                match msg {
+                    BoundsCheck { ref len, ref index } => {
+                        len.visit_with(visitor)?;
+                        index.visit_with(visitor)
+                    }
+                    Overflow(_, l, r) => {
+                        l.visit_with(visitor)?;
+                        r.visit_with(visitor)
+                    }
+                    OverflowNeg(op) | DivisionByZero(op) | RemainderByZero(op) => {
+                        op.visit_with(visitor)
                     }
-                } else {
-                    ControlFlow::CONTINUE
+                    ResumedAfterReturn(_) | ResumedAfterPanic(_) => ControlFlow::CONTINUE,
                 }
             }
             InlineAsm { ref operands, .. } => operands.visit_with(visitor),