Avoid ICEing without the pattern_types feature gate

This commit is contained in:
Oli Scherer 2024-04-08 21:02:13 +00:00
parent 07310e21d4
commit 24ee9b9423
3 changed files with 43 additions and 1 deletions

View file

@ -2249,7 +2249,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
Ty::new_pat(tcx, ty, pat)
}
hir::PatKind::Err(e) => Ty::new_error(tcx, e),
_ => span_bug!(pat.span, "unsupported pattern for pattern type: {pat:#?}"),
_ => Ty::new_error_with_message(
tcx,
pat.span,
format!("unsupported pattern for pattern type: {pat:#?}"),
),
};
self.record_ty(pat.hir_id, ty, pat.span);
pat_ty