rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.73k stars 12.5k forks source link

Inconsistent behaviour when using < and > in casted environments #59872

Closed Licenser closed 5 years ago

Licenser commented 5 years ago

when comparing a type cast f64 > and < behave differently see:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=03511939f184aad522383ddb03d25e44

While I don't want to say which is the 'right' behavior, it should be consistent over both > and < .

jonas-schievink commented 5 years ago

We could either reject _ as f64 > X as well, which would be a breaking change (and not a necessary one), or somehow find a way to allow _ as f64 < X, which would likely involve infinite parser lookahead. Both routes are RFC territory and at least the latter has been discussed in the past for other reasons, so closing in favor of an RFC discussion.

Licenser commented 5 years ago

Could we link the RFC discussion for reference?

jonas-schievink commented 5 years ago

The most recent one I believe is https://github.com/rust-lang/rfcs/pull/2544