Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0672d7f

Browse files
authoredFeb 10, 2024
Rollup merge of rust-lang#120865 - saethlin:missing-o-files, r=nnethercote
Turn the "no saved object file in work product" ICE into a translatable fatal error I don't know if it's fair to say this fixes rust-lang#120854 but it surely makes the error reporting better and should encourage people with good instincts like ``@CinchBlue.``
2 parents 206669f + 3d4a9f5 commit 0672d7f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed
 

‎compiler/rustc_codegen_ssa/messages.ftl

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ codegen_ssa_no_module_named =
190190
191191
codegen_ssa_no_natvis_directory = error enumerating natvis directory: {$error}
192192
193+
codegen_ssa_no_saved_object_file = cached cgu {$cgu_name} should have an object file, but doesn't
194+
193195
codegen_ssa_processing_dymutil_failed = processing debug info with `dsymutil` failed: {$status}
194196
.note = {$output}
195197

‎compiler/rustc_codegen_ssa/src/back/write.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,9 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
913913

914914
let object = load_from_incr_comp_dir(
915915
cgcx.output_filenames.temp_path(OutputType::Object, Some(&module.name)),
916-
module.source.saved_files.get("o").expect("no saved object file in work product"),
916+
module.source.saved_files.get("o").unwrap_or_else(|| {
917+
cgcx.create_dcx().emit_fatal(errors::NoSavedObjectFile { cgu_name: &module.name })
918+
}),
917919
);
918920
let dwarf_object =
919921
module.source.saved_files.get("dwo").as_ref().and_then(|saved_dwarf_object_file| {

‎compiler/rustc_codegen_ssa/src/errors.rs

+6
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ pub struct NoNatvisDirectory {
121121
pub error: Error,
122122
}
123123

124+
#[derive(Diagnostic)]
125+
#[diag(codegen_ssa_no_saved_object_file)]
126+
pub struct NoSavedObjectFile<'a> {
127+
pub cgu_name: &'a str,
128+
}
129+
124130
#[derive(Diagnostic)]
125131
#[diag(codegen_ssa_copy_path_buf)]
126132
pub struct CopyPathBuf {

0 commit comments

Comments
 (0)
Please sign in to comment.