|
2 | 2 |
|
3 | 3 | use rustc_ast::InlineAsmOptions; |
4 | 4 | use rustc_index::IndexVec; |
5 | | -use rustc_middle::mir::interpret::ErrorHandled; |
6 | 5 | use rustc_middle::ty::adjustment::PointerCoercion; |
7 | 6 | use rustc_middle::ty::layout::FnAbiOf; |
8 | 7 | use rustc_middle::ty::print::with_no_trimmed_paths; |
@@ -251,21 +250,15 @@ pub(crate) fn verify_func( |
251 | 250 | } |
252 | 251 |
|
253 | 252 | fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) { |
254 | | - match fx.mir.post_mono_checks(fx.tcx, ty::ParamEnv::reveal_all(), |c| Ok(fx.monomorphize(c))) { |
255 | | - Ok(()) => {} |
256 | | - Err(ErrorHandled::TooGeneric(span)) => { |
257 | | - span_bug!(span, "codegen encountered polymorphic constant"); |
258 | | - } |
259 | | - Err(ErrorHandled::Reported(info, span)) => { |
260 | | - if !info.is_tainted_by_errors() { |
261 | | - fx.tcx.sess.span_err(span, "erroneous constant encountered"); |
262 | | - } |
263 | | - fx.bcx.append_block_params_for_function_params(fx.block_map[START_BLOCK]); |
264 | | - fx.bcx.switch_to_block(fx.block_map[START_BLOCK]); |
265 | | - // compilation should have been aborted |
266 | | - fx.bcx.ins().trap(TrapCode::UnreachableCodeReached); |
267 | | - return; |
268 | | - } |
| 253 | + if let Err(err) = |
| 254 | + fx.mir.post_mono_checks(fx.tcx, ty::ParamEnv::reveal_all(), |c| Ok(fx.monomorphize(c))) |
| 255 | + { |
| 256 | + err.emit_err(fx.tcx); |
| 257 | + fx.bcx.append_block_params_for_function_params(fx.block_map[START_BLOCK]); |
| 258 | + fx.bcx.switch_to_block(fx.block_map[START_BLOCK]); |
| 259 | + // compilation should have been aborted |
| 260 | + fx.bcx.ins().trap(TrapCode::UnreachableCodeReached); |
| 261 | + return; |
269 | 262 | } |
270 | 263 |
|
271 | 264 | let arg_uninhabited = fx |
|
0 commit comments