Skip to content

Commit

Permalink
Rollup merge of #40685 - portal-chan:patch-1, r=eddyb
Browse files Browse the repository at this point in the history
Add missing associated type Item to Iterator
  • Loading branch information
frewsxcv authored Mar 21, 2017
2 parents c6b2110 + 1a00c8f commit b6240e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/doc/unstable-book/src/conservative-impl-trait.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ fn main() {
In today's Rust, you can write function signatures like:

````rust,ignore
fn consume_iter_static<I: Iterator<u8>>(iter: I) { }
fn consume_iter_static<I: Iterator<Item=u8>>(iter: I) { }
fn consume_iter_dynamic(iter: Box<Iterator<u8>>) { }
fn consume_iter_dynamic(iter: Box<Iterator<Item=u8>>) { }
````

In both cases, the function does not depend on the exact type of the argument.
Expand All @@ -50,13 +50,13 @@ The type held is "abstract", and is assumed only to satisfy a trait bound.
On the other hand, while you can write:

````rust,ignore
fn produce_iter_dynamic() -> Box<Iterator<u8>> { }
fn produce_iter_dynamic() -> Box<Iterator<Item=u8>> { }
````

...but you _cannot_ write something like:

````rust,ignore
fn produce_iter_static() -> Iterator<u8> { }
fn produce_iter_static() -> Iterator<Item=u8> { }
````

That is, in today's Rust, abstract return types can only be written using trait
Expand Down

0 comments on commit b6240e5

Please sign in to comment.