Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAudit iterator specializations for side effects #28810
Comments
rust-highfive
added
the
I-nominated
label
Oct 2, 2015
alexcrichton
added
T-libs
and removed
I-nominated
labels
Oct 2, 2015
alexcrichton
referenced this issue
Oct 2, 2015
Closed
Specialise count, last and nth for Cloned and Map iterators #28125
alexcrichton
added
the
I-nominated
label
Oct 2, 2015
This comment has been minimized.
This comment has been minimized.
|
I've checked Unless, of course, you care about drop order. I haven't tried to reason about that. |
This comment has been minimized.
This comment has been minimized.
|
The slice iterators ( |
This comment has been minimized.
This comment has been minimized.
|
|
bors
pushed a commit
that referenced
this issue
Oct 3, 2015
bors
added a commit
that referenced
this issue
Oct 3, 2015
This comment has been minimized.
This comment has been minimized.
|
I'd appreciate it if someone else double checked but I think that's all of them. |
This comment has been minimized.
This comment has been minimized.
This is relevant as well, because implementations of Drop may also (and usually do, in form of memory deallocation) contain side effects. Can we make a
|
This comment has been minimized.
This comment has been minimized.
I strongly disagree. Drop has side effects but programmers should never rely on drop order except stack drop order because drop order is often unspecified (e.g. within structs). Drop out of order
Audited
|
This comment has been minimized.
This comment has been minimized.
Ah right, this will be decided by rust-lang/rfcs#744 anyway. |
This comment has been minimized.
This comment has been minimized.
|
Awesome, thanks for the work here @Stebalien! |
This comment has been minimized.
This comment has been minimized.
|
Updated list of out-of-order drops (didn't notice |
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium |
rust-highfive
added
P-medium
and removed
I-nominated
labels
Oct 7, 2015
This comment has been minimized.
This comment has been minimized.
|
(Need to make sure this behavior is documented/explicitly promised.) |
This comment has been minimized.
This comment has been minimized.
|
Is this done? (Everything in the list above is |
This comment has been minimized.
This comment has been minimized.
|
I believe this is left open as to-be-documented. Also, I don't see any decision as to whether out of order drop is ok. |
steveklabnik
added
A-allocators
A-docs
and removed
T-libs
A-allocators
labels
Jan 6, 2016
This comment has been minimized.
This comment has been minimized.
|
re-tagging as docs |
This comment has been minimized.
This comment has been minimized.
|
So I believe that all of these are then documented in Iterator's methods, at least as far as I can tell. Can someone from libs double check me here and help provide any specifics as to what's not documented? |
steveklabnik
added
the
T-libs
label
Jan 7, 2016
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Jan 7, 2016
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Jan 9, 2016
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Jan 9, 2016
This comment has been minimized.
This comment has been minimized.
|
Looks good to me, thanks @steveklabnik! |
alexcrichton commentedOct 2, 2015
After some discussion about #28125 the libs subteam decided that iterator adaptors should always preserve the same semantics in terms of the convenience methods and such. This was not audited for when all the initial specializations landed, so we should take a look and make sure that everything adheres to this policy.
Additionally, documentation should be added to the
Iteratortrait methods indicating what form of guarantees you are given (e.g. callinglastis equivalent to exhausting the iterator).triage: I-nominated