Skip to content

Commit 9215ead

Browse files
committed
Fix handling on InlineAsm for the unconditional recursion lint.
1 parent 46db0df commit 9215ead

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/librustc_mir_build/lints.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,14 @@ impl<'mir, 'tcx> TriColorVisitor<&'mir Body<'tcx>> for Search<'mir, 'tcx> {
114114
| TerminatorKind::Unreachable
115115
| TerminatorKind::Yield { .. } => ControlFlow::Break(NonRecursive),
116116

117-
// FIXME(Amanieu): I am not 100% sure about this, but it triggers
118-
// a spurious warning otherwise.
119-
TerminatorKind::InlineAsm { .. } => ControlFlow::Break(NonRecursive),
117+
// A diverging InlineAsm is treated as non-recursing
118+
TerminatorKind::InlineAsm { destination, .. } => {
119+
if destination.is_some() {
120+
ControlFlow::Continue
121+
} else {
122+
ControlFlow::Break(NonRecursive)
123+
}
124+
}
120125

121126
// These do not.
122127
TerminatorKind::Assert { .. }

0 commit comments

Comments
 (0)