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

libcore: make iterator adaptors Cloneable #19827

Merged
merged 1 commit into from
Dec 17, 2014
Merged

Conversation

japaric
Copy link
Member

@japaric japaric commented Dec 14, 2014

closes #12677 (cc @Valloric)
cc #15294

r? @aturon / @alexcrichton

(Because of #19358 I had to move the struct bounds from the where clause into the parameter list)

@@ -1444,7 +1445,8 @@ impl<A, B, I, F> RandomAccessIterator<B> for Map<A, B, I, F> where
/// An iterator which filters the elements of `iter` with `predicate`
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Filter<A, I, P> where I: Iterator<A>, P: FnMut(&A) -> bool {
#[deriving(Copy, Clone)]
pub struct Filter<A, I: Iterator<A>, P: FnMut(&A) -> bool> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to "de-where" these?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my PR message:

"(Because of #19358 I had to move the struct bounds from the where clause into the parameter list)"

@alexcrichton
Copy link
Member

Due to #18045, maybe we should avoid Copy for now?

@japaric japaric changed the title libcore: make iterator adaptors Clone/Copyable libcore: make iterator adaptors Cloneable Dec 14, 2014
@japaric
Copy link
Member Author

japaric commented Dec 14, 2014

@alexcrichton Removed the #[deriving(Copy)]s.

@bluss
Copy link
Member

bluss commented Dec 14, 2014

Doesn't deriving insert bogus bounds (A: Clone) ?

@japaric
Copy link
Member Author

japaric commented Dec 14, 2014

Doesn't deriving insert bogus bounds (A: Clone) ?

Yes :/. deriving doesn't do the Right Thing. I've opened #19839 for a possible solution for that. I'll switch to manual impls + FIXMEs.

@bluss
Copy link
Member

bluss commented Dec 14, 2014

You can copy my code. I wrote up a PR to do this too (didn't see yours).

@japaric
Copy link
Member Author

japaric commented Dec 14, 2014

@alexcrichton @gankro switched to manual impls. re-r?
@bluss Thanks for pointing out the issue!

@bluss
Copy link
Member

bluss commented Dec 14, 2014

Great to get this finally :-) thank you.

bors referenced this pull request Dec 16, 2014
This creates an enormous amount of spew.
bors added a commit that referenced this pull request Dec 16, 2014
libcore: make iterator adaptors `Clone`able

Reviewed-by: alexcrichton
bors referenced this pull request Dec 16, 2014
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `VecMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
bors added a commit that referenced this pull request Dec 16, 2014
libcore: make iterator adaptors `Clone`able

Reviewed-by: alexcrichton
bors added a commit that referenced this pull request Dec 17, 2014
libcore: make iterator adaptors `Clone`able

Reviewed-by: alexcrichton
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 17, 2014
closes rust-lang#12677 (cc @Valloric)
cc rust-lang#15294

r? @aturon / @alexcrichton

(Because of rust-lang#19358 I had to move the struct bounds from the `where` clause into the parameter list)
@bors bors merged commit 2f7a5f4 into rust-lang:master Dec 17, 2014
@japaric japaric deleted the clone-uc branch December 20, 2014 12:30
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 this pull request may close these issues.

std::str::Bytes should implement Clone
6 participants