diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-10 13:12:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-10 13:12:31 +0100 |
| commit | 9a8958f2bb9e2a9f7440226c23213725b4d777fa (patch) | |
| tree | 14bd4f1285eb48114bf91dde508be653ba680224 /compiler/rustc_codegen_ssa/src | |
| parent | 2dbc9f55f76aac46c0e9ed31b60d8c2960d2f5f0 (diff) | |
| parent | 3d4a9f504780dd8f9ba4e7921cce8d8517c20aa6 (diff) | |
| download | rust-9a8958f2bb9e2a9f7440226c23213725b4d777fa.tar.gz rust-9a8958f2bb9e2a9f7440226c23213725b4d777fa.zip | |
Rollup merge of #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 https://github.com/rust-lang/rust/issues/120854 but it surely makes the error reporting better and should encourage people with good instincts like ```@CinchBlue.```
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/errors.rs | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 9b24339d255..a63642d76b9 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -913,7 +913,9 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>( let object = load_from_incr_comp_dir( cgcx.output_filenames.temp_path(OutputType::Object, Some(&module.name)), - module.source.saved_files.get("o").expect("no saved object file in work product"), + module.source.saved_files.get("o").unwrap_or_else(|| { + cgcx.create_dcx().emit_fatal(errors::NoSavedObjectFile { cgu_name: &module.name }) + }), ); let dwarf_object = module.source.saved_files.get("dwo").as_ref().and_then(|saved_dwarf_object_file| { diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index 06ea5b9e8f4..3d7903b5efb 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -122,6 +122,12 @@ pub struct NoNatvisDirectory { } #[derive(Diagnostic)] +#[diag(codegen_ssa_no_saved_object_file)] +pub struct NoSavedObjectFile<'a> { + pub cgu_name: &'a str, +} + +#[derive(Diagnostic)] #[diag(codegen_ssa_copy_path_buf)] pub struct CopyPathBuf { pub source_file: PathBuf, |
