Skip to content

Commit f822e28

Browse files
committed
Report CodegenError::Unsupported as a rustc diagnostic instead of panicking
1 parent 052d958 commit f822e28

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/base.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ pub(crate) fn compile_fn(
220220
);
221221
early_dcx.early_fatal(format!("cranelift verify error:\n{}", pretty_error));
222222
}
223+
Err(ModuleError::Compilation(CodegenError::Unsupported(msg))) => {
224+
let early_dcx = rustc_session::EarlyDiagCtxt::new(
225+
rustc_session::config::ErrorOutputType::default(),
226+
);
227+
early_dcx.early_fatal(format!("cranelift codegen error: {msg}"));
228+
}
223229
Err(err) => {
224230
panic!("Error while defining {name}: {err:?}", name = codegened_func.symbol_name);
225231
}

0 commit comments

Comments
 (0)