diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-25 06:18:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-25 06:18:01 +0200 |
| commit | a302155344af987a6ae4aab6cf820e279bbdcf63 (patch) | |
| tree | 5d0d9f9038a5bdeaa7a1b74190d9ddbf9784cb46 /src/test/debuginfo/enum-thinlto.rs | |
| parent | d54111afc061ef398cd8ce28984f9e8d70001b24 (diff) | |
| parent | c36b9ddcb40b81642cef2d1dd17bcd45f54c70da (diff) | |
| download | rust-a302155344af987a6ae4aab6cf820e279bbdcf63.tar.gz rust-a302155344af987a6ae4aab6cf820e279bbdcf63.zip | |
Rollup merge of #62959 - LukasKalbertodt:array-value-iter, r=scottmcm
Add by-value iterator for arrays
This adds an iterator that can iterate over arrays by value, yielding all elements by value. However, **this PR does _not_ add a corresponding `IntoIterator` impl for arrays**. The `IntoIterator` impl needs some discussion about backwards-compatibility that should take place in a separate PR. With this patch, this code should work (but there is currently still a bug):
```rust
#![feature(array_value_iter)]
use std::array::IntoIter;
let arr = [1, 2, 3];
for x in IntoIter::new(arr) {
println!("{}", x);
}
```
**TODO**:
- [x] Get initial feedback
- [x] Add tests
- [x] Figure out why stage1 produces weird bugs ([comment](https://github.com/rust-lang/rust/pull/62959#issuecomment-516016524))
- [x] Add UI tests as mentioned [here](https://github.com/rust-lang/rust/pull/62959#discussion_r307061894) (will do that soon-ish)
- [x] Fix [this new bug](https://github.com/rust-lang/rust/pull/62959#issuecomment-544732159)
**Notes for reviewers**
- Is the use of `MaybeUninit` correct here? I think it has to be used due to the `Clone` impl which has to fill the dead array elements with something, but cannot fill it with a correct instance.
- Are the unit tests sufficient?
CC #25725
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
