Fix bug in integer range matching#57978
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @oli-obk |
There was a problem hiding this comment.
So this basically makes sure that unsigned comparison of signed numbers still works out?
There was a problem hiding this comment.
Yeah. I'll add a comment.
|
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 |
|
@bors r+ |
|
📌 Commit 441355d7c2fe99b1e666d3c30ee9b6c7996547bf has been approved by |
|
@bors r- r=me with the comment nit addressed |
|
@varkor your update to the comment (890198445cde6603ea58c67a3177d38c36da4ede) continues to refer to floating-point numbers rather than signed integers (which is what I had interpreted @matthewjasper 's comment nit as referring to). So now I am inferring that you did in fact mean to reference floating-point numbers in your comment. I haven't attempted to validate the reasoning in the comment/code when applied to floating-point numbers.
But, both your own code here and the referenced code in pattern/_match.rs, is only going to look at ranges constructed from one of the types { ... so ... is there some way that floating point values can arise in these code paths? Even the underlying representation in the MIR interpreter, as far as I can tell, avoids using floating-point values... |
|
(If in fact floating-point values can arise ... I guess I'd expect to see a unit test illustrating that scenario...) |
|
Sorry, I must have been distracted when editing the comment; it should not refer to floating-point numbers at all. I think I was conflating it with another problem I've been thinking about recently. Floating-point range patterns are not permitted in this location and do not need to be handled. I shall update the comment (and squash all of the edits) once I get back to my computer. Sorry for the confusion. |
8901984 to
cd1047e
Compare
|
@bors r=oli-obk |
|
📌 Commit cd1047e has been approved by |
…oli-obk Fix bug in integer range matching Fixes #57894.
|
☀️ Test successful - checks-travis, status-appveyor |
[beta] Rollup backports Cherry-picked: * #58008: Pass correct arguments to places_conflict * #58007: Don't panic when accessing enum variant ctor using `Self` in match * #57978: Fix bug in integer range matching * #57862: Build the standard library for thumbv7neon-unknown-linux-gnueabihf in CI * #57659: Fix release manifest generation r? @ghost
Fixes #57894.