Skip to content

Commit

Permalink
Rollup merge of #78830 - lcnr:mir-folder, r=oli-obk
Browse files Browse the repository at this point in the history
fix `super_visit_with` for `Terminator`

fixes #78182 (comment)

r? `@oli-obk`

cc `@LeSeulArtichaut`
  • Loading branch information
Dylan-DPC authored Nov 9, 2020
2 parents 4e0695b + 103f7a4 commit 7924ecc
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions compiler/rustc_middle/src/mir/type_foldable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,21 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
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),
Expand Down

0 comments on commit 7924ecc

Please sign in to comment.