Skip to content

Use associated types in binop traits #20390

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

Closed
wants to merge 1 commit into from

Conversation

japaric
Copy link
Member

@japaric japaric commented Jan 1, 2015

binop traits (Add, Sub, etc) now have an associated type for their return type. Also the RHS input parameter defaults to Self (except for the Shl and Shr traits). For example, the Add trait now looks like this:

trait Add<Rhs=Self> {
    type Result;

    fn add(self, Rhs) -> Self::Result;
}

This breaks all existing implementation of these traits.

[breaking-change]


Needs a snapshot that contains PR #20374

There are some cfail test that are ICEing, I have marked those with a FIXME. We can land this after a snapshot, or wait for fix of those cfail ICEs before landing this.

r? @aturon

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@japaric japaric changed the title At binops Use associated types in binop traits Jan 1, 2015
@aturon
Copy link
Member

aturon commented Jan 1, 2015

YES! Happy new year :-)

@nikomatsakis
Copy link
Contributor

Nice! 💃

@aturon
Copy link
Member

aturon commented Jan 1, 2015

r=me once we're ready to land this.

@japaric
Copy link
Member Author

japaric commented Jan 1, 2015

Closing in favor of #20410

@japaric japaric closed this Jan 1, 2015
@japaric japaric deleted the at-binops branch January 4, 2015 13:06
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.

4 participants