]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #47126 - sdroege:exact-chunks, r=bluss
authorkennytm <kennytm@gmail.com>
Mon, 15 Jan 2018 08:55:28 +0000 (16:55 +0800)
committerkennytm <kennytm@gmail.com>
Mon, 15 Jan 2018 10:49:31 +0000 (18:49 +0800)
Add slice::ExactChunks and ::ExactChunksMut iterators

These guarantee that always the requested slice size will be returned
and any leftoever elements at the end will be ignored. It allows llvm to
get rid of bounds checks in the code using the iterator.

This is inspired by the same iterators provided by ndarray.

Fixes https://github.com/rust-lang/rust/issues/47115

I'll add unit tests for all this if the general idea and behaviour makes sense for everybody.
Also see https://github.com/rust-lang/rust/issues/47115#issuecomment-354715511 for an example what this improves.

1  2 
src/liballoc/slice.rs
src/liballoc/tests/slice.rs
src/libcore/slice/mod.rs
src/libcore/tests/slice.rs

Simple merge
Simple merge
Simple merge
Simple merge