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