Fix ICE on invalid const param types

This commit is contained in:
Gurinder Singh 2024-04-27 09:36:38 +05:30
parent 3a36386dc1
commit c62bc31b16
4 changed files with 49 additions and 6 deletions

View file

@ -386,6 +386,8 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
fn ct_infer(&self, ty: Ty<'tcx>, _: Option<&ty::GenericParamDef>, span: Span) -> Const<'tcx> {
let ty = self.tcx.fold_regions(ty, |r, _| match *r {
rustc_type_ir::RegionKind::ReStatic => r,
// This is never reached in practice. If it ever is reached,
// `ReErased` should be changed to `ReStatic`, and any other region
// left alone.