File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ use rustc_middle::ty::layout::FnAbiOf;
7
7
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
8
8
9
9
use cranelift_codegen:: ir:: UserFuncName ;
10
+ use cranelift_codegen:: CodegenError ;
11
+ use cranelift_module:: ModuleError ;
10
12
11
13
use crate :: constant:: ConstantCx ;
12
14
use crate :: debuginfo:: FunctionDebugContext ;
@@ -172,7 +174,26 @@ pub(crate) fn compile_fn(
172
174
// Define function
173
175
cx. profiler . generic_activity ( "define function" ) . run ( || {
174
176
context. want_disasm = cx. should_write_ir ;
175
- module. define_function ( codegened_func. func_id , context) . unwrap ( ) ;
177
+ match module. define_function ( codegened_func. func_id , context) {
178
+ Ok ( ( ) ) => { }
179
+ Err ( ModuleError :: Compilation ( CodegenError :: ImplLimitExceeded ) ) => {
180
+ // FIXME pass the error to the main thread and do a span_fatal instead
181
+ rustc_session:: early_error (
182
+ rustc_session:: config:: ErrorOutputType :: HumanReadable (
183
+ rustc_errors:: emitter:: HumanReadableErrorType :: Default (
184
+ rustc_errors:: emitter:: ColorConfig :: Auto ,
185
+ ) ,
186
+ ) ,
187
+ format ! (
188
+ "backend implementation limit exceeded while compiling {name}" ,
189
+ name = codegened_func. symbol_name
190
+ ) ,
191
+ ) ;
192
+ }
193
+ Err ( err) => {
194
+ panic ! ( "Error while defining {name}: {err:?}" , name = codegened_func. symbol_name) ;
195
+ }
196
+ }
176
197
} ) ;
177
198
178
199
if cx. should_write_ir {
You can’t perform that action at this time.
0 commit comments