Skip to content
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

Add missing associated type Item to Iterator #40685

Merged
merged 1 commit into from
Mar 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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