summary refs log tree commit diff
path: root/src/libcore/tests
AgeCommit message (Collapse)AuthorLines
2019-06-20Rollup merge of #60772 - timvermeulen:slice_iter_nth_back, r=scottmcmMazdak Farrokhzad-0/+13
Implement nth_back for slice::{Iter, IterMut} Part of #54054. I implemented `nth_back` as straightforwardly as I could, and then slightly changed `nth` to match `nth_back`. I believe I did so correctly, but please double-check 🙂 I also added the helper methods `zst_shrink`, `next_unchecked`, and `next_back_unchecked` to get rid of some duplicated code. These changes hopefully make this code easier to understand for new contributors like me. I noticed the `is_empty!` and `len!` macros which sole purpose seems to be inlining, according to the comment right above them, but the `is_empty` and `len` methods are already marked with `#[inline(always)]`. Does that mean we could replace these macros with method calls, without affecting anything? I'd love to get rid of them.
2019-06-20Rollup merge of #60454 - acrrd:issues/54054_skip, r=scottmcmMazdak Farrokhzad-0/+34
Add custom nth_back to Skip Implementation of nth_back for Skip. Part of #54054
2019-06-13Rollup merge of #61398 - kennytm:stabilize-copy-within, r=SimonSapinMazdak Farrokhzad-1/+14
Stabilize copy_within Closes #54236.
2019-06-12Rollup merge of #61671 - koalatux:nth-back-range, r=KodrAusMazdak Farrokhzad-0/+37
implement nth_back for Range(Inclusive) This is part of #54054.
2019-06-09implement nth_back for RangeInclusiveAdrian Friedli-0/+20
2019-06-09Miri: disable a slow testRalf Jung-0/+2
2019-06-08implement nth_back for RangeAdrian Friedli-0/+17
2019-06-06Rollup merge of #61376 - czipperz:bound-cloned, r=sfacklerMazdak Farrokhzad-1/+17
Add Bound::cloned() Suggested by #61356
2019-06-04Update src/libcore/tests/slice.rskennytm-1/+1
Co-Authored-By: Jack O'Connor <oconnor663@gmail.com>
2019-06-02copy_within: replace element access by pointer arithmetic to avoid UBkennytm-0/+14
This ensures we won't accidentally read *src or *dest even when count = 0.
2019-06-01Enable feature bound_cloned for testsChris Gregory-0/+1
2019-06-01Rollup merge of #61364 - lzutao:stabilize-reverse_bits, r=CentrilMazdak Farrokhzad-1/+0
Stabilize reverse_bits feature FCP done in https://github.com/rust-lang/rust/issues/48763#issuecomment-497349379 Closes #48763 r? @Centril
2019-05-31Import Bound in testsChris Gregory-1/+1
2019-05-31Add Bound testsChris Gregory-0/+15
2019-05-31Stabilize copy_withinkennytm-1/+0
2019-05-31Stabilize reverse_bits featureLzu Tao-1/+0
2019-05-30Stabilize iter_nth_back featureLzu Tao-1/+0
2019-05-29Add custom nth_back for SkipAndrea Corradi-0/+34
2019-05-29Rollup merge of #61048 - wizAmit:feature/nth_back_chunks, r=scottmcmMazdak Farrokhzad-0/+24
Feature/nth back chunks A succinct implementation for nth_back on chunks. Thank you @timvermeulen for the guidance. r? @timvermeulen
2019-05-29Rollup merge of #60555 - timvermeulen:rchunks_nth_back, r=scottmcmMazdak Farrokhzad-0/+52
Implement nth_back for RChunks(Exact)(Mut) Part of #54054. These implementations may not be optimal because of the use of `self.len()`, but it's quite cheap and simplifies the code a lot. There's quite some duplication going on here, I wouldn't mind cleaning this up later. A good next step would probably be to add private `split_off_up_to`/`split_off_from` helper methods for slices since their behavior is commonly useful throughout the `Chunks` types. r? @scottmcm
2019-05-29Rollup merge of #58975 - jtdowney:iter_arith_traits_option, r=dtolnayMazdak Farrokhzad-0/+16
Implement `iter::Sum` and `iter::Product` for `Option` This is similar to the existing implementation for `Result`. It will take each item into the accumulator unless a `None` is returned. I based a lot of this on #38580. From that discussion it didn't seem like this addition would be too controversial or difficult. One thing I still don't understand is picking the values for the `stable` attribute. This is my first non-documentation PR for rust so I am open to any feedback on improvements.
2019-05-25Implement nth_back for slice::{Iter, IterMut}Tim Vermeulen-0/+13
2019-05-22fix merge conflictswizAmit-1/+0
2019-05-22succint implementationwizAmit-0/+24
2019-05-22wip nth_back on chunks@amit.chandra-19/+0
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
2019-05-22hopefully working nth_back on chunks@amit.chandra-1/+8
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
2019-05-22wip nth_back on chunks@amit.chandra-0/+13
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
2019-05-14new implementation for nth_back for chunkswizAmit-1/+5
2019-05-14Add const_unchecked_layout test to libcore/testsRichard Wiedenhöft-0/+12
2019-05-14hopefully working nth_back on chunks@amit.chandra-1/+8
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
2019-05-14wip nth_back on chunks@amit.chandra-0/+13
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
2019-05-13Rollup merge of #60201 - RalfJung:core-tests, r=alexcrichtonMazdak Farrokhzad-1/+1
coretest: Downgrade deny to warn The `deny` causes a build failure in https://github.com/RalfJung/miri-test-libstd. Since we use `-D warnings` for rustc builds, `warn` should be enough to lead to compile errors here, without impeding external builds.
2019-05-05Implement nth_back for RChunks(Exact)(Mut)Tim Vermeulen-0/+52
2019-04-27Stabilize Iterator::copied in 1.36.0.Mazdak Farrokhzad-1/+0
2019-04-26Remove feature gates from std and testsChristopher Serr-1/+0
2019-04-25Auto merge of #60192 - t-rapp:tr-saturating-funcs, r=alexcrichtonbors-0/+27
Implement saturating_abs() and saturating_neg() functions for signed integer types Similar to wrapping_abs() / wrapping_neg() functions but saturating at the numeric bounds instead of wrapping around. Complements the existing set of functions with saturation mechanics. cc #59983
2019-04-25Add tests for saturating_abs() and saturating_neg functionsTobias Rapp-0/+27
2019-04-23deny -> warnRalf Jung-1/+1
2019-04-22Remove double trailing newlinesvarkor-6/+0
2019-04-20Deny rust_2018_idioms in libcore testsPhilipp Hansch-38/+38
2019-04-19Rollup merge of #60023 - koalatux:nth-back, r=scottmcmMazdak Farrokhzad-0/+18
implement specialized nth_back() for Bytes, Fuse and Enumerate Hi, After my first PR has been successfully merged, here is my second pull request :-) Also this PR contains some specializations for the problem discussed in #54054.
2019-04-18libcore => 2018Taiki Endo-3/+3
2019-04-17test sort_unstable in MiriRalf Jung-3/+12
2019-04-16implement nth_back for EnumerateAdrian Friedli-0/+18
2019-04-16Miri now supports entropy, but is still slowRalf Jung-2/+2
2019-04-05Include trailing comma in multiline Debug representationDavid Tolnay-26/+26
This commit changes the behavior of Formatter::debug_struct, debug_tuple, debug_list, debug_set, and debug_map to render trailing commas in {:#?} mode, which is the dominant style in modern Rust code. Before: Language { name: "Rust", trailing_commas: false } After: Language { name: "Rust", trailing_commas: true, }
2019-04-03Rollup merge of #55448 - Mokosha:SortAtIndex, r=blussMazdak Farrokhzad-0/+119
Add 'partition_at_index/_by/_by_key' for slices. This is an analog to C++'s std::nth_element (a.k.a. quickselect). Corresponds to tracking bug #55300.
2019-04-02Rollup merge of #59444 - cuviper:steps_between, r=scottmcmMazdak Farrokhzad-0/+61
Implement useful steps_between for all integers We can use `usize::try_from` to convert steps from any size of integer. This enables a meaningful `size_hint()` for larger ranges, rather than always just `(0, None)`. Now they return the true `(len, Some(len))` when it fits, otherwise `(usize::MAX, None)` for overflow.
2019-03-31Stabilize refcell_replace_swap feature, closes #43570Jean-Marie Comets-1/+0
2019-03-28Rollup merge of #58717 - hellow554:nonzero_parse, r=oli-obkMazdak Farrokhzad-3/+24
Add FromStr impl for NonZero types This is a WIP implementation because I do have some questions regarding the solution. Somebody should ping the lang team on this I guess. Please see the annotations on the code for more details. Closes #58604