]> git.lizzy.rs Git - rust.git/commit
auto merge of #20490 : japaric/rust/assoc-types, r=aturon
authorbors <bors@rust-lang.org>
Sun, 4 Jan 2015 00:50:59 +0000 (00:50 +0000)
committerbors <bors@rust-lang.org>
Sun, 4 Jan 2015 00:50:59 +0000 (00:50 +0000)
commitc6c786671d692d7b13c2e5c68a53001327b4b125
tree540a25d1333da9581000eb20a54664ecdb3f0bcb
parent496dc4eae7de9d14cd49511a9acfbf5f11ae6c3f
parentce8f748b4cd64317c33d64ccf3a6127931980d90
auto merge of #20490 : japaric/rust/assoc-types, r=aturon

closes #20486
closes #20474
closes #20441

[breaking-change]

The `Index[Mut]` traits now have one less input parameter, as the return type of the indexing operation is an associated type. This breaks all existing implementations.

---

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

``` rust
trait Add<Rhs=Self> {
    type Output;

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

The `Neg` and `Not` traits now also have an associated type for their return type.

This breaks all existing implementations of these traits.

---
Affected traits:

- `Iterator { type Item }`
- `IteratorExt` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `DoubleEndedIterator` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `DoubleEndedIteratorExt` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `RandomAccessIterator` no input/output types
- `ExactSizeIterator` no input/output types, uses `<Self as Iterator>::Item` in its methods

This breaks all the implementations of these traits.
src/librustc/middle/check_match.rs
src/librustc/middle/traits/select.rs
src/librustc/middle/ty.rs
src/librustc_trans/trans/base.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/regionck.rs