about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-12-16 23:24:13 +0000
committerbors <bors@rust-lang.org>2017-12-16 23:24:13 +0000
commit1b1c792c77ad16a466d7943eb887b0a8a76526e1 (patch)
treefc0afc893a26271164e7ee4e2b23aeaba487c9c2
parent3bee2b44cfd5610ad0346f0179602d91a8dedfd0 (diff)
parenta399326ca2ec6ec69c786fd6c6c8335388424952 (diff)
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.
-rw-r--r--src/librustc_trans/back/lto.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_trans/back/lto.rs b/src/librustc_trans/back/lto.rs
index 48c3fd638c3..aa7754a7ab0 100644
--- a/src/librustc_trans/back/lto.rs
+++ b/src/librustc_trans/back/lto.rs
@@ -613,7 +613,10 @@ impl ThinModule {
             self.data().len(),
             self.shared.module_names[self.idx].as_ptr(),
         );
-        assert!(!llmod.is_null());
+        if llmod.is_null() {
+            let msg = format!("failed to parse bitcode for thin LTO module");
+            return Err(write::llvm_err(&diag_handler, msg));
+        }
         let mtrans = ModuleTranslation {
             source: ModuleSource::Translated(ModuleLlvm {
                 llmod,