Rollup merge of #78830 - lcnr:mir-folder, r=oli-obk

fix `super_visit_with` for `Terminator`

fixes https://github.com/rust-lang/rust/pull/78182#discussion_r509265149

r? `@oli-obk`

cc `@LeSeulArtichaut`
This commit is contained in:
Dylan DPC 2020-11-09 19:06:59 +01:00 committed by GitHub
commit 7924ecc341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
} else {
ControlFlow::CONTINUE
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,
}
}
InlineAsm { ref operands, .. } => operands.visit_with(visitor),