Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#124394 - gurry:123863-ice-unexpected-region, r=lcnr Fix ICE on invalid const param types Fixes ICE rust-lang#123863 which occurs because the const param has a type which is not a `bool`, `char` or an integral type. The ICEing code path begins here in `typeck_with_fallback`: https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_typeck/src/lib.rs#L167 The `fallback` invokes the `type_of` query and that eventually ends up calling `ct_infer` from the lowering code over here: https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs#L561 and `ct_infer` ICEs at this location: https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_analysis/src/collect.rs#L392 To fix the ICE it I'm triggering a `span_delayed_bug` before we hit `ct_infer` if the type of the const param is not one of the supported types ### Edit On `@lcnr's` suggestion I've changed the approach to not let `ReStatic` region hit the `bug!` in `ct_infer` instead of triggering a `span_delayed_bug`.
- Loading branch information