-
Notifications
You must be signed in to change notification settings - Fork 13.4k
librustc_mir: Fix ICE with slice patterns #57538
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @zackmdavis (rust_highfive has picked a reviewer for you, use r? to override) |
ty::Array(_, len) if len.assert_usize(cx.tcx).is_none() => | ||
cx.tcx.types.err, | ||
_ => ty, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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