-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Cleanup const_float_classify
#13510
base: master
Are you sure you want to change the base?
Cleanup const_float_classify
#13510
Conversation
const_float_classify
const_float_classify
&& ( | ||
matches!(cx.tcx.constness(cx.tcx.hir().enclosing_body_owner(expr.hir_id)), Constness::NotConst) | ||
|| cx.tcx.features().declared(sym!(const_float_classify)) | ||
) | ||
&& matches!(cx.tcx.constness(cx.tcx.hir().enclosing_body_owner(expr.hir_id)), Constness::NotConst) |
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.
If I understand the issue correctly, it sounds like we should rather replace the cx.tcx.features().declared(...)
check with an MSRV check, since these functions are now stable in const.
With the current diff, we would never emit a warning in const code
// Will be linted if `const_float_classify` is enabled | ||
if const { X == f64::INFINITY || X == f64::NEG_INFINITY } {} |
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.
Would be good to have a test where this now emits a warning. Something like
const {
let x = 1.0f64;
if x == f64::INFINITY || x == f64::NEG_INFINITY {}
}
should suffice I think
55688a8
to
55d1e88
Compare
55d1e88
to
3f68c41
Compare
a100fd2
to
cb19f23
Compare
Looks good to me. Thank you! @bors r+ |
…llogiq Cleanup `const_float_classify` As mentioned at #13508 `const_float_classify` has been stabilized recently in rust-lang/rust#130157 and can be cleanup Close #13508 changelog: [none]
As mentioned at #13508
const_float_classify
has been stabilized recently in rust-lang/rust#130157 and can be cleanupClose #13508
changelog: [none]