Skip to content

Commit 1b1c792

Browse files
committed
Auto merge of #46750 - varkor:imp-llmod, r=estebank
Improve error messages on LLVM bitcode parsing failure The LLVM error causing the parse failure is now printed, in the style of the other thin LTO error messages. This prevents a flood of assertion failure messages if the bitcode can’t be parsed.
2 parents 3bee2b4 + a399326 commit 1b1c792

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: src/librustc_trans/back/lto.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,10 @@ impl ThinModule {
613613
self.data().len(),
614614
self.shared.module_names[self.idx].as_ptr(),
615615
);
616-
assert!(!llmod.is_null());
616+
if llmod.is_null() {
617+
let msg = format!("failed to parse bitcode for thin LTO module");
618+
return Err(write::llvm_err(&diag_handler, msg));
619+
}
617620
let mtrans = ModuleTranslation {
618621
source: ModuleSource::Translated(ModuleLlvm {
619622
llmod,

0 commit comments

Comments
 (0)