-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix integer_division false negative for NonZero denominators #14664
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
base: master
Are you sure you want to change the base?
Fix integer_division false negative for NonZero denominators #14664
Conversation
Failed to set assignee to
|
r? clippy |
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.
Great bugfix, althought I have some light comments =^w^= 🐱
let left_ty = cx.typeck_results().expr_ty(left); | ||
let right_ty = cx.typeck_results().expr_ty(right); |
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.
Could you move this to below that initial op == hir::BinOpKind::Div
so that we don't calculate expression types on all expressions?
@@ -12,4 +16,8 @@ fn main() { | |||
//~^ integer_division | |||
|
|||
let x = 1. / 2.0; | |||
|
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.
Just for future resilience, could you also add a test for NonZero / <integer>
and NonZero / NonZero
Close #14652
changelog: [
integer_division
]: fix false negative for NonZero denominators