diff options
| author | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2016-07-24 13:56:27 +0300 |
|---|---|---|
| committer | Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> | 2016-09-16 15:08:32 +0300 |
| commit | 7b25e886028195a4f90c0baa5cc9101ebeceb5a3 (patch) | |
| tree | 7899d0115549790a45f227311015fe4733c9ca86 /src/rustllvm/RustWrapper.cpp | |
| parent | eb19cd65756cd285c81410e627752a75a41e3f0e (diff) | |
| download | rust-7b25e886028195a4f90c0baa5cc9101ebeceb5a3.tar.gz rust-7b25e886028195a4f90c0baa5cc9101ebeceb5a3.zip | |
forbid moves out of slices
The wording of RFC #495 enables moves out of slices. Unfortuantely, non-zeroing
moves out of slices introduce a very annoying complication: as slices can
vary in their length, indexes from the start and end may or may not overlap
depending on the slice's exact length, which prevents assigning a particular
drop flag for each individual element.
For example, in the code
```Rust
fn foo<T>(a: Box<[Box<[T]>]>, c: bool) -> T {
match (a, c) {
(box [box [t, ..], ..], true) => t,
(box [.., box [.., t]], false) => t,
_ => panic!()
}
}
```
If the condition is false, we have to drop the first element
of `a`, unless `a` has size 1 in which case we drop all the elements
of it but the last.
If someone comes with a nice way of handling it, we can always re-allow
moves out of slices.
This is a [breaking-change], but it is behind the `slice_patterns` feature
gate and was not allowed until recently.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
