-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace f16
and f128
pattern matching stubs with real implementations
#123088
Conversation
Some changes occurred in exhaustiveness checking cc @Nadrieril |
Happy to add a test here if you can point me in the right direction, even though what we can actually test is probably pretty limited at this point. @rustbot label +F-f16_and_f128 |
This comment has been minimized.
This comment has been minimized.
👍 r=me when CI passes |
Whoops I forgot to do the other half of that enum, thanks for the quick look |
Ah yeah, if you have enough implemented a small test would be nice. For example checking that a match expression with two identical |
Sure, I can do that. Is there any home for pattern matching tests? Nothing in tests/ui jumps out to me Edit: oh of course, |
6862b01
to
284129a
Compare
This comment has been minimized.
This comment has been minimized.
The home for exhaustiveness tests is tests/ui/pattern/usefulness, there's already a file that tests float patterns somewhere there probably |
What you're testing with the tests you added is the execution of matches, i.e. match MIR lowering and codegen. The code you modify in this PR is match checking which is about exhaustiveness and the "unreachable pattern" lint |
ping me again when this is unblocked so I can have a final look |
Sounds good, I'll probably just wait for #122470 to land. Thanks for the help! |
☔ The latest upstream changes (presumably #123264) made this pull request unmergeable. Please resolve the merge conflicts. |
284129a
to
1b62868
Compare
Some changes occurred in match checking cc @Nadrieril |
This comment has been minimized.
This comment has been minimized.
f26fabc
to
a125259
Compare
@Nadrieril I think this is ready for a look now, basic library support got merged so that is no longer blocking anything. There are a handful of FIXMEs still because we don't have the For tests I just updated everything that contains a @rustbot ready |
This comment has been minimized.
This comment has been minimized.
fn check_f16() { | ||
const F1: f16 = 0.0; | ||
const F2: f16 = -0.0; | ||
assert_eq!(F1, F2); |
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.
Test failed here. Assuming you ran the tests on your machine, is this platform-specific behavior? Sounds like a nightmare
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.
That said, this is unrelated to this PR since this PR only deals with exhaustiveness checking of floats. You could comment these tests out and fix that in a different PR.
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.
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.
Ah yeah if these are hitting any runtime tests then there will be problems on some platforms, I thought everything was going through const eval. I’ll cfg the relevant parts out when I’m back at a computer.
// FIXME(f16_f128): enable infinity tests when constants are available | ||
// assert!(yes!(f16::NEG_INFINITY, ..=f16::NEG_INFINITY)); | ||
// assert!(yes!(f16::NEG_INFINITY, ..=1.0f16)); | ||
assert!(yes!(1.5f16, ..=1.5f16)); |
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.
Also a failure here
da113aa
to
9c44b60
Compare
@Nadrieril I gated the f16 and f128 tests to only run on aarch64 Linux like I have for #126608, which is the most common platform without ABI issues or missing f128 symbols. As beetrees says, at least the x86 issues with f16 should be fixed when compiler_builtins gets bumped, the others will probably take longer. @rustbot ready |
@@ -1,4 +1,6 @@ | |||
#![deny(unreachable_patterns)] |
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.
These will get executed as well. You can make the whole test //@ check-pass
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.
Thanks for the catch, changed
9c44b60
to
abf8fed
Compare
This comment has been minimized.
This comment has been minimized.
Oops I got entirely confused: that file was meant to give compile errors x) Please remove the |
…ions This section of code depends on `rustc_apfloat` rather than our internal types, so this is one potential ICE that we should be able to melt now. This also fixes some missing range and match handling in `rustc_middle`.
abf8fed
to
28ce7cd
Compare
It fooled me too, I put it back |
Let's try again! @bors r+ |
☀️ Test successful - checks-actions |
Hey, it worked 🎉 thanks for the review! |
Finished benchmarking commit (aabbf84): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (secondary 5.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -2.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (secondary -0.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 693.516s -> 691.47s (-0.30%) |
This section of code depends on
rustc_apfloat
rather than our internal types, so this is one potential ICE that we should be able to melt now.r? @Nadrieril