rust
rust copied to clipboard
Fix ICE while casting a type with error
Fixes #124848
The ICE originates here: https://github.com/rust-lang/rust/blob/f9a3fd966162b3c7386d90fe4626471f66ba3b8f/compiler/rustc_hir_typeck/src/cast.rs#L143 The underlying cause is that a type with error, MyType
was involved in a cast. During cast checks the below method pointer_kind
was called: https://github.com/rust-lang/rust/blob/f9a3fd966162b3c7386d90fe4626471f66ba3b8f/compiler/rustc_hir_typeck/src/cast.rs#L87-L91 Thanks to the changes in PR #123491, type_is_sized_modulo_regions
in pointer_kind
returned false
which caused control to reach the span_bug
here: https://github.com/rust-lang/rust/blob/f9a3fd966162b3c7386d90fe4626471f66ba3b8f/compiler/rustc_hir_typeck/src/cast.rs#L143 resulting in an ICE.
This PR fixes the issue by changing the span_bug
to a span_delayed_bug
.
r? @Nadrieril
rustbot has assigned @Nadrieril. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r?
to explicitly pick a reviewer
@bors r+
:pushpin: Commit fb619ec208b898bad1505c97ee79408b2c60926b has been approved by Nadrieril
It is now in the queue for this repository.