Skip to content

Commit 1a00c8f

Browse files
authored
Add missing associated type Item to Iterator
1 parent 134c4a0 commit 1a00c8f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/doc/unstable-book/src/conservative-impl-trait.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ fn main() {
3333
In today's Rust, you can write function signatures like:
3434

3535
````rust,ignore
36-
fn consume_iter_static<I: Iterator<u8>>(iter: I) { }
36+
fn consume_iter_static<I: Iterator<Item=u8>>(iter: I) { }
3737
38-
fn consume_iter_dynamic(iter: Box<Iterator<u8>>) { }
38+
fn consume_iter_dynamic(iter: Box<Iterator<Item=u8>>) { }
3939
````
4040

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

5252
````rust,ignore
53-
fn produce_iter_dynamic() -> Box<Iterator<u8>> { }
53+
fn produce_iter_dynamic() -> Box<Iterator<Item=u8>> { }
5454
````
5555

5656
...but you _cannot_ write something like:
5757

5858
````rust,ignore
59-
fn produce_iter_static() -> Iterator<u8> { }
59+
fn produce_iter_static() -> Iterator<Item=u8> { }
6060
````
6161

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

0 commit comments

Comments
 (0)