Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upPattern guard problem replacing FP literal pattern #42663
Comments
leonardo-m
referenced this issue
Jun 19, 2017
Closed
Tracking issue for `illegal_floating_point_constant_pattern` compatibility lint #36890
Mark-Simulacrum
added
the
T-compiler
label
Jun 23, 2017
Mark-Simulacrum
added
C-question
C-bug
I-needs-decision
T-lang
C-feature-request
and removed
C-question
C-bug
labels
Jul 27, 2017
This comment has been minimized.
This comment has been minimized.
|
Dupe of #15287. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
leonardo-m commentedJun 14, 2017
This is an Rust language ergonomy problem regarding pattern matching that contains floating point values.
This is a reduction of code that was OK:
Those FP patterns will go away, so I've tried to replace them like this:
But I get errors:
The pattern guard is "if z == 0.0" it uses just z and a FP contanst, it doesn't touch the x value.
I'd like ergonomy improvements to solve this problem in some nice way at language level (or Prelude level).
See also the short thread:
https://users.rust-lang.org/t/pattern-guard-problem-replacing-fp-literal-pattern/11207