librustc_mir: Fix ICE with slice patterns#57538
Conversation
|
r? @zackmdavis (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Not sure if this is the best way to fix this. I also thought about changing check_arm to not add "incomplete" arms to the seen Matrix, but I couldn't figure out how to determine if an arm was "incomplete".
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
290d01e to
8f11c61
Compare
If a match arm does not include all fields in a structure and a later pattern includes a field that is an array, we will attempt to use the array type from the prior arm. When calculating the field type, treat a array of an unknown size as a TyErr.
7cdc10d to
d6c1919
Compare
|
Seems reasonable to me. @bors r+ |
|
📌 Commit d6c1919 has been approved by |
librustc_mir: Fix ICE with slice patterns If a match arm does not include all fields in a structure and a later pattern includes a field that is an array, we will attempt to use the array type from the prior arm. When calculating the field type, treat a array of an unknown size as a `TyErr`. Fixes: rust-lang#57472
Rollup of 4 pull requests Successful merges: - #56874 (Simplify foreign type rendering.) - #57113 (Move diagnostics out from QueryJob and optimize for the case with no diagnostics) - #57366 (Point at match discriminant on type error in match arm pattern) - #57538 (librustc_mir: Fix ICE with slice patterns) Failed merges: - #57381 (Tweak output of type mismatch between "then" and `else` `if` arms) r? @ghost
If a match arm does not include all fields in a structure and a later
pattern includes a field that is an array, we will attempt to use the
array type from the prior arm. When calculating the field type, treat
a array of an unknown size as a
TyErr.Fixes: #57472