Skip to content

Commit 1de6839

Browse files
authored
Rollup merge of rust-lang#93402 - ehuss:llvm-dialog, r=michaelwoerister
Windows: Disable LLVM crash dialog boxes. This disables the crash dialog box on Windows. When LLVM hits an assertion, it will open a dialog box with Abort/Retry/Ignore. This is annoying on CI because CI will just hang until it times out (which can take hours). Instead of opening a dialog box, it will print a message like this: ``` Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file D:\Proj\rust\rust\src\llvm-project\llvm\include\llvm/Support/Casting.h, line 255 ``` Closes rust-lang#92829
2 parents 099cacb + c64d6bf commit 1de6839

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
987987

988988
extern "C" {
989989
pub fn LLVMRustInstallFatalErrorHandler();
990+
pub fn LLVMRustDisableSystemDialogsOnCrash();
990991

991992
// Create and destroy contexts.
992993
pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;

compiler/rustc_codegen_llvm/src/llvm_util.rs

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ unsafe fn configure_llvm(sess: &Session) {
4646
let mut llvm_args = Vec::with_capacity(n_args + 1);
4747

4848
llvm::LLVMRustInstallFatalErrorHandler();
49+
// On Windows, an LLVM assertion will open an Abort/Retry/Ignore dialog
50+
// box for the purpose of launching a debugger. However, on CI this will
51+
// cause it to hang until it times out, which can take several hours.
52+
if std::env::var_os("CI").is_some() {
53+
llvm::LLVMRustDisableSystemDialogsOnCrash();
54+
}
4955

5056
fn llvm_arg_to_arg_name(full_arg: &str) -> &str {
5157
full_arg.trim().split(|c: char| c == '=' || c.is_whitespace()).next().unwrap_or("")

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ extern "C" void LLVMRustInstallFatalErrorHandler() {
7676
install_fatal_error_handler(FatalErrorHandler);
7777
}
7878

79+
extern "C" void LLVMRustDisableSystemDialogsOnCrash() {
80+
sys::DisableSystemDialogsOnCrash();
81+
}
82+
7983
extern "C" char *LLVMRustGetLastError(void) {
8084
char *Ret = LastError;
8185
LastError = nullptr;

0 commit comments

Comments
 (0)