AnthonyMikh
7efba4f982
Implement indexing slices with pairs of ops::Bound<usize>
2021-04-13 09:57:24 -04:00
Folyd
3eb5bee242
Fix binary_search_by()
overflow issue in ZST case
2021-02-27 22:11:44 +08:00
Folyd
7d078cfb94
Simplify binary search logic to full branch code to let CPU guessing branch more precisely
2021-01-30 14:11:47 +08:00
Folyd
18e44a1be4
Improve slice.binary_search_by()'s best-case performance to O(1)
2021-01-30 14:11:47 +08:00
Josh Stone
9202fbdbdb
Check for exhaustion in SliceIndex for RangeInclusive
2020-10-20 17:18:08 -07:00
James Gill
01ac5a97c9
Stabilize slice_select_nth_unstable
...
This stabilizes the functionality in slice_partition_at_index,
but under the names `select_nth_unstable*`. The functions
`partition_at_index*` are left as deprecated, to be removed in
a later release.
Closes #55300
2020-10-12 00:07:41 -04:00
Alexis Bourget
a61b9638bb
review: fix nits and move panic safety tests to the correct place
2020-09-25 23:10:24 +02:00
Alexis Bourget
275eed7eb1
Move vec-slice-drop test
2020-09-21 21:50:27 +02:00
kadmin
f240abc1dc
Add array window fn
...
Updated issue to #75027
Update to rm oob access
And hopefully fix docs as well
Fixed naming conflict in test
Fix test which used 1-indexing
Nth starts from 0, woops
Fix a bunch of off by 1 errors
See https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=757b311987e3fae1ca47122969acda5a
Add even more off by 1 errors
And also write `next` and `next_back` in terms of `nth` and `nth_back`.
Run fmt
Fix forgetting to change fn name in test
add nth_back test & document unsafe
Remove as_ref().unwrap()
Documented occurrences of unsafe, noting what invariants are maintained
2020-09-16 14:52:20 +00:00
Josh Stone
b9fd6734e8
Add tests for array_chunks_mut
2020-09-04 19:51:29 -07:00
bors
ef55a0a92f
Auto merge of #75207 - dylni:add-slice-check-range, r=KodrAus
...
Add `slice::check_range`
This method is useful for [`RangeBounds`] parameters. It's even been [rewritten](22ee68dc58/src/librustc_data_structures/sorted_map.rs (L214)
) [many](22ee68dc58/library/alloc/src/vec.rs (L1299)
) [times](22ee68dc58/library/core/src/slice/mod.rs (L2441)
) in the standard library, sometimes assuming that the bounds won't be [`usize::MAX`].
For example, [`Vec::drain`] creates an empty iterator when [`usize::MAX`] is used as an inclusive end bound:
```rust
assert!(vec![1].drain(..=usize::max_value()).eq(iter::empty()));
```
If this PR is merged, I'll create another to use it for those methods.
[`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
[`usize::MAX`]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.MAX
[`Vec::drain`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.drain
2020-09-04 12:21:43 +00:00
Ralf Jung
6a06bfc252
enable align_to tests in Miri
2020-08-19 10:41:51 +02:00
dylni
d04e6b8de5
Replace ad hoc implementations with slice::check_range
2020-08-16 21:47:12 -04:00
Yuki Okushi
7d18040b0c
Rollup merge of #74974 - RalfJung:miri-tests, r=Mark-Simulacrum
...
Make tests faster in Miri
Reduce some test iteration counts in Miri.
2020-08-03 01:05:20 +09:00
Ralf Jung
ff0c3a9209
expand comments
2020-07-31 14:03:42 +02:00
Ralf Jung
7468f632ff
also reduce some libcore test iteration counts
2020-07-31 11:56:08 +02:00
Bastian Kauschke
d27007fd6d
add tests for array_chunks
2020-07-30 10:50:34 +02:00
mark
2c31b45ae8
mv std libs to library/
2020-07-27 19:51:13 -05:00