File tree 1 file changed +18
-0
lines changed
compiler/rustc_hir_analysis/src/hir_ty_lowering
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -551,6 +551,24 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
551
551
if let Err ( guar) = ty. error_reported ( ) {
552
552
return ty:: Const :: new_error ( tcx, guar, ty) . into ( ) ;
553
553
}
554
+
555
+ let param_span = match tcx. hir ( ) . span_if_local ( param. def_id ) {
556
+ Some ( sp) => sp,
557
+ _ => self . span ,
558
+ } ;
559
+
560
+ // Ensure that the const param does not have an unsupported
561
+ // type or we ICE later (see #123863)
562
+ if !tcx. features ( ) . adt_const_params
563
+ && !matches ! ( ty. kind( ) , ty:: Bool | ty:: Char | ty:: Int ( _) | ty:: Uint ( _) )
564
+ {
565
+ let guar = tcx. dcx ( ) . span_delayed_bug (
566
+ param_span,
567
+ "Const param has unsupported type but no error emitted" ,
568
+ ) ;
569
+ return ty:: Const :: new_error ( tcx, guar, ty) . into ( ) ;
570
+ } ;
571
+
554
572
// FIXME(effects) see if we should special case effect params here
555
573
if !infer_args && has_default {
556
574
tcx. const_param_default ( param. def_id )
You can’t perform that action at this time.
0 commit comments