-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Overloaded augmented assignments #28345
Conversation
☔ The latest upstream changes (presumably #28358) made this pull request unmergeable. Please resolve the merge conflicts. |
@@ -167,14 +155,16 @@ fn check_overloaded_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, | |||
lhs_expr: &'tcx hir::Expr, | |||
lhs_ty: Ty<'tcx>, | |||
rhs_expr: &'tcx hir::Expr, | |||
op: hir::BinOp) | |||
op: hir::BinOp, | |||
assign: bool) |
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.
Nit: can we newtype this bool? I think I prefer something like:
struct IsAssign(bool)
and then in the call foo(..., IsAssign(true))
, though IsAssign::Yes
is also ok.
This looks good. r+ modulo nits -- can you also add a test that you can't implement Also: I think it may be worth waiting to land this until the beta is released, just in case it introduces accidental breakage. |
@nikomatsakis I've addressed all your comments (I think)
I did try using the same feature name for the language feature and for the traits, but it didn't work. What I observed is that when I added
Sounds good to me |
☔ The latest upstream changes (presumably #28336) made this pull request unmergeable. Please resolve the merge conflicts. |
@japaric ok feel free to r=me once rebased |
@bors r=nmatsakis |
📌 Commit f5569ec has been approved by |
⌛ Testing commit f5569ec with merge c61bf60... |
💔 Test failed - auto-linux-64-opt |
@bors retry |
⌛ Testing commit f5569ec with merge 295d51f... |
💔 Test failed - auto-linux-64-opt |
@bors: retry On Sat, Sep 19, 2015 at 4:08 AM, bors notifications@github.com wrote:
|
Implements overload-able augmented/compound assignments, like `a += b` via the `AddAssign` trait, as specified in RFC [953] [953]: https://github.com/rust-lang/rfcs/blob/master/text/0953-op-assign.md r? @nikomatsakis
Implements overload-able augmented/compound assignments, like
a += b
via theAddAssign
trait, as specified in RFC 953r? @nikomatsakis