Skip to content

Multiple *stable* iterator adaptors have useless type parameters #21839

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
Tobba opened this issue Feb 1, 2015 · 1 comment · Fixed by #21842
Closed

Multiple *stable* iterator adaptors have useless type parameters #21839

Tobba opened this issue Feb 1, 2015 · 1 comment · Fixed by #21842

Comments

@Tobba
Copy link
Contributor

Tobba commented Feb 1, 2015

For example

#[stable(feature = "rust1", since = "1.0.0")]
pub struct Peekable<T, I> where I: Iterator<Item=T> {
    iter: I,
    peeked: Option<T>,
}

Here the T type parameter is completely useless as it's always going to be equal to I::Item, and this is present in nearly every iterator adaptor, all which are marked stable.

@bluss
Copy link
Member

bluss commented Feb 1, 2015

Several of them would have had to change anyway to obey the new impl check rules. Don't know if the situation has changed since then (updated orphan rules again etc).

alexcrichton added a commit to alexcrichton/rust that referenced this issue Feb 1, 2015
Now that associated types are fully implemented the iterator adaptors only need
type parameters which are associated with actual storage. All other type
parameters can either be derived from these (e.g. they are an associated type)
or can be bare on the `impl` block itself.

This is a breaking change due to the removal of type parameters on these
iterator adaptors, but code can fairly easily migrate by just deleting the
relevant type parameters for each adaptor. Other behavior should not be
affected.

Closes rust-lang#21839
[breaking-change]
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 2, 2015
 Now that associated types are fully implemented the iterator adaptors only need
type parameters which are associated with actual storage. All other type
parameters can either be derived from these (e.g. they are an associated type)
or can be bare on the `impl` block itself.

This is a breaking change due to the removal of type parameters on these
iterator adaptors, but code can fairly easily migrate by just deleting the
relevant type parameters for each adaptor. Other behavior should not be
affected.

Closes rust-lang#21839
[breaking-change]
alexcrichton added a commit to alexcrichton/rust that referenced this issue Feb 2, 2015
Now that associated types are fully implemented the iterator adaptors only need
type parameters which are associated with actual storage. All other type
parameters can either be derived from these (e.g. they are an associated type)
or can be bare on the `impl` block itself.

This is a breaking change due to the removal of type parameters on these
iterator adaptors, but code can fairly easily migrate by just deleting the
relevant type parameters for each adaptor. Other behavior should not be
affected.

Closes rust-lang#21839
[breaking-change]
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 a pull request may close this issue.

3 participants