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 upremove certain array elem moves for non-zeroing drop #533
Conversation
nikomatsakis
assigned
pnkfelix
Dec 19, 2014
This comment has been minimized.
This comment has been minimized.
reem
commented
Dec 20, 2014
|
My only worry here is that I'd like there to be a way to get a by-value Iterator over a small, constant number of items without allocating (right now it requires |
This comment has been minimized.
This comment has been minimized.
|
This version of array indexing isn't useful for iterators, as it prevents access to all elements of the array except the one accessed. The problem with array iterators is that we can't have impls generic over integers. |
This comment has been minimized.
This comment has been minimized.
thestinger
commented
Dec 20, 2014
|
@reem: It definitely doesn't prevent that. Look at how the by-value vector iterator is implemented. |
This comment has been minimized.
This comment has been minimized.
thestinger
commented
Dec 20, 2014
|
It's not going to work well though, because you need to take the fixed-size array by-value... which is not going to scale at all. |
This comment has been minimized.
This comment has been minimized.
reem
commented
Dec 20, 2014
|
I guess it is orthogonal to this RFC, but I imagined the implementation would take some form of |
This comment has been minimized.
This comment has been minimized.
|
@reem removing language features such as this now does not preclude making other independent additions in the future that would enable useful functionality. The only issue I could see would be if there is some useful pattern that is allowed today that would be made invalid by changes in this RFC, but as far as I can tell (and as mentioned in the comments above) the example you describe cannot be expressed today. |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis can we get discussion of this at a meeting? |
pnkfelix
referenced this pull request
Jan 16, 2015
Closed
borrow-checker allows partial reinit of struct that has been moved away, but no use of it. #21232
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis please do bring this up with core team when you can. |
pnkfelix
referenced this pull request
Feb 4, 2015
Closed
Restrictions on moves into and out-from fixed-length arrays. #21930
This comment has been minimized.
This comment has been minimized.
|
We've decided to accept this RFC. The precautions here are sensible and unlikely to have wide-spread impact on Rust code. If necessary, they can be lifted later, at the cost of more complex codegen. |
nikomatsakis
referenced this pull request
Feb 5, 2015
Closed
Forbid some moves out of array elements (RFC #533) #21963
nikomatsakis
merged commit 58ce407
into
rust-lang:master
Feb 5, 2015
nikomatsakis
added a commit
that referenced
this pull request
Feb 5, 2015
This comment has been minimized.
This comment has been minimized.
|
Tracking issue rust-lang/rust#21963. |
pnkfelix commentedDec 19, 2014
Summary
In order to prepare for an expected future implementation of
non-zeroing dynamic drop, remove support for:
[T, ..n],(copying and borrowing such elements is still permitted).
(rendered)