Skip to content

fix: Refactor & improve handling of overloaded binary operators #9988

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

Merged
merged 1 commit into from
Aug 22, 2021

Conversation

flodiebold
Copy link
Member

Fixes #9971. Also records them as method resolutions, which we could use later.

Fixes rust-lang#9971. Also records them as method resolutions, which we could use
later.
@flodiebold flodiebold changed the title Refactor & improve handling of overloaded binary operators fix: Refactor & improve handling of overloaded binary operators Aug 22, 2021
@flodiebold
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 22, 2021

@bors bors bot merged commit 1c27243 into rust-lang:master Aug 22, 2021
@flodiebold flodiebold deleted the overloaded-binops branch August 22, 2021 16:09
let lhs_diverges = self.diverges;
self.infer_expr_coerce(*rhs, &Expectation::HasType(bool_ty.clone()));
// Depending on the LHS' value, the RHS can never execute.
self.diverges = lhs_diverges;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be self.diverges &= lhs_diverges;? For cases like true && loop {}.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that would still only 'maybe' diverge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Normalization issue with operators or Deref
2 participants