File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
compiler/rustc_llvm/llvm-wrapper Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -470,6 +470,14 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
470
470
// it prevents control flow from "falling through" into whatever code
471
471
// happens to be laid out next in memory.
472
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
+ }
473
481
}
474
482
475
483
if (Singlethread) {
You can’t perform that action at this time.
0 commit comments