File tree 1 file changed +8
-0
lines changed
compiler/rustc_llvm/llvm-wrapper
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -468,6 +468,14 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
468
468
// it prevents control flow from "falling through" into whatever code
469
469
// happens to be laid out next in memory.
470
470
Options.TrapUnreachable = true ;
471
+ // But don't emit traps after other traps or no-returns unnecessarily.
472
+ // ...except for when targeting WebAssembly, because the NoTrapAfterNoreturn
473
+ // option causes bugs in the LLVM WebAssembly backend. You should be able to
474
+ // remove this check when Rust's minimum supported LLVM version is >= 18
475
+ // https://github.com/llvm/llvm-project/pull/65876
476
+ if (!Trip.isWasm ()) {
477
+ Options.NoTrapAfterNoreturn = true ;
478
+ }
471
479
}
472
480
473
481
if (Singlethread) {
You can’t perform that action at this time.
0 commit comments