Skip to content
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

remove 'illegal_floating_point_literal_pattern' future-compat lint #116098

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test checking behavior of matching on floats
  • Loading branch information
RalfJung committed Sep 24, 2023
commit afe7676bf49a3033e06d6f830cf44f9ee99ae443
11 changes: 11 additions & 0 deletions tests/ui/match/match-float.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// run-pass
// Makes sure we use `==` (not bitwise) semantics for float comparison.

fn main() {
const F1: f32 = 0.0;
const F2: f32 = -0.0;
assert_eq!(F1, F2);
assert_ne!(F1.to_bits(), F2.to_bits());
assert!(matches!(F1, F2));
assert!(matches!(F2, F1));
}