Skip to content

Commit 1ca8d26

Browse files
committed
Better error
1 parent a7c59df commit 1ca8d26

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/driver/lto.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,15 @@ pub(super) fn load_lto_modules(
195195
object::read::File::parse(child.data(&*archive_data).expect("corrupt rlib"))
196196
.unwrap();
197197
let module = SerializableModule::deserialize(
198-
lto_object.section_by_name(".rodata.cgclif_lto").unwrap().data().unwrap(),
198+
lto_object
199+
.section_by_name(".rodata.cgclif_lto")
200+
.unwrap_or_else(|| {
201+
tcx.sess
202+
.dcx()
203+
.fatal(format!("no LTO data found for {}({name})", path.display()));
204+
})
205+
.data()
206+
.unwrap(),
199207
crate::build_isa(tcx.sess, false),
200208
);
201209
modules.push((name.to_owned(), module));

0 commit comments

Comments
 (0)