We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7cc997d + 4a8c5cb commit c935604Copy full SHA for c935604
compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -480,6 +480,14 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
480
// it prevents control flow from "falling through" into whatever code
481
// happens to be laid out next in memory.
482
Options.TrapUnreachable = true;
483
+ // But don't emit traps after other traps or no-returns unnecessarily.
484
+ // ...except for when targeting WebAssembly, because the NoTrapAfterNoreturn
485
+ // option causes bugs in the LLVM WebAssembly backend. You should be able to
486
+ // remove this check when Rust's minimum supported LLVM version is >= 18
487
+ // https://github.com/llvm/llvm-project/pull/65876
488
+ if (!Trip.isWasm()) {
489
+ Options.NoTrapAfterNoreturn = true;
490
+ }
491
}
492
493
if (Singlethread) {
0 commit comments