about summary refs log tree commit diff
path: root/src/libcore/slice
AgeCommit message (Collapse)AuthorLines
2019-02-20Rollup merge of #58553 - scottmcm:more-ihle, r=Centrilkennytm-16/+16
Use more impl header lifetime elision Inspired by seeing explicit lifetimes on these two: - https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator - https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not And a follow-up to https://github.com/rust-lang/rust/pull/54687, that started using IHLE in libcore. Most of the changes in here fall into two big categories: - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm). I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-17Use more impl header lifetime elisionScott McMurray-16/+16
There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-12Revert "Remove mentions of unstable sort_by_cached key from stable ↵Scott McMurray-0/+4
documentation" This reverts commit 9c7b69e17909ceb090a1c4b8882a4e0924a2a755.
2019-02-10libs: doc commentsAlexander Regueiro-5/+5
2019-02-10tests: doc commentsAlexander Regueiro-7/+7
2019-01-28rename first_mut_ptr -> first_ptr_mutRalf Jung-4/+4
2019-01-28add macro for creating uninitialized arrayRalf Jung-9/+2
2019-01-28libcore: avoid mem::uninitialized and raw ptr castsRalf Jung-6/+13
2019-01-22Move TrustedRandomAccess into Zip moduleClar Fon-1/+0
2019-01-22Rollup merge of #57604 - alercah:str-index, r=sfacklerMazdak Farrokhzad-3/+13
Make `str` indexing generic on `SliceIndex`. Fixes #55603
2019-01-19Make `str` indexing generic on `SliceIndex`.Alexis Hunt-3/+13
2019-01-17Override `Iterator::is_sorted_by` in `slice::Iter` implLukas Kalbertodt-13/+22
Additionally, the root implementation was changed a bit: it now uses `all` instead of coding that logic manually. To avoid duplicate code, the inherent `[T]::is_sorted_by` method now calls `self.iter().is_sorted_by(...)`. This should always be inlined and not result in overhead.
2019-01-17Compare pairs with `slice::windows`Kevin Leimkuhler-7/+5
2019-01-17Improve documentation and slice implKevin Leimkuhler-9/+12
2019-01-17Add is_sorted unstable documentationKevin Leimkuhler-0/+2
2019-01-17Add is_sorted impl for [T]Kevin Leimkuhler-1/+78
2019-01-13Cosmetic improvementsAlexander Regueiro-15/+14
2018-12-25Remove licensesMark Rousskov-39/+0
2018-12-17deny intra-doc link resolution failures in libstdAndy Russell-0/+2
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-13/+14
2018-12-06Fix a stutter in the docs for slice::exact_chunksChris Barrick-2/+1
2018-11-23use MaybeUninit in core::slice::rotateRalf Jung-9/+3
Code by @japaric, I just split it into individual commits
2018-11-23use MaybeUninit in core::slice::sortRalf Jung-7/+7
Code by @japaric, I just split it into individual commits
2018-11-22Auto merge of #53918 - Havvy:doc-sort-by, r=GuillaumeGomezbors-0/+16
Doc total order requirement of sort(_unstable)_by I took the definition of what a total order is from the Ord trait docs. I specifically put "elements of the slice" because if you have a slice of f64s, but know none are NaN, then sorting by partial ord is total in this case. I'm not sure if I should give such an example in the docs or not. r? @GuillaumeGomez
2018-11-10revert making internal APIs const fn.Mazdak Farrokhzad-4/+4
2018-11-10reduce list to functions callable in const ctx.Mazdak Farrokhzad-2/+2
2018-11-10constify parts of libcore.Mazdak Farrokhzad-7/+6
2018-10-18Stabilize slice::rchunks(), rchunks_mut(), rchunks_exact(), rchunk_exact_mut()Sebastian Dröge-40/+32
Fixes #55177
2018-10-18Stabilize slice::chunks_exact() and slice::chunks_exact_mut()Sebastian Dröge-21/+17
Fixes #47115
2018-10-18Auto merge of #54580 - sdroege:rchunks, r=SimonSapinbors-33/+717
Add slice::rchunks(), rchunks_mut(), rchunks_exact() and rchunks_exact_mut() These work exactly like the normal chunks iterators but start creating chunks from the end of the slice. ---- The new iterators were motivated by a [comment](https://github.com/rust-lang/rust/issues/47115#issuecomment-424141121) by @DutchGhost. ~~~This currently includes the commits from https://github.com/rust-lang/rust/pull/54537 to not have to rename things twice or have merge conflicts. I'll force-push a new version of the branch ones those are in master.~~~ Also the stabilization tracking issue is just some number right now. I'll create the corresponding issue once this is reviewed and otherwise mergeable. cc @DutchGhost
2018-10-18Add slice::rchunks(), rchunks_mut(), rchunks_exact() and rchunks_exact_mut()Sebastian Dröge-33/+717
These work exactly like the normal chunks iterators but start creating chunks from the end of the slice. See #55177 for the tracking issue
2018-10-12Auto merge of #54534 - nagisa:align-offset-simplification, r=alexcrichtonbors-1/+1
Simplify implementation of align_offset slightly
2018-10-08Auto merge of #54700 - frewsxcv:frewsxcv-binary-search, r=GuillaumeGomezbors-10/+13
Clarify docs for when binary_search has many matches. Fixes https://github.com/rust-lang/rust/issues/51817.
2018-10-07Clarify docs for when binary_search has many matches.Corey Farwell-10/+13
Fixes https://github.com/rust-lang/rust/issues/51817.
2018-10-05Linkify types in docsHavvy (Ryan Scheel)-1/+1
2018-10-05Slice total example: Move closer to total defnHavvy (Ryan Scheel)-6/+9
2018-10-05Example of total ord of elements for sort_byHavvy (Ryan Scheel)-0/+6
2018-10-05Doc total order requirement of sort(_unstable)_byHavvy (Ryan Scheel)-0/+7
I took the definition of what a total order is from the Ord trait docs. I specifically put "elements of the slice" because if you have a slice of f64s, but know none are NaN, then sorting by partial ord is total in this case. I'm not sure if I should give such an example in the docs or not.
2018-10-02Rollup merge of #54687 - scottmcm:more-elision, r=dtolnayPietro Albini-48/+48
Use impl_header_lifetime_elision in libcore The feature is approved for stabilization, so let's use it to remove about 300 `'a`s. Tracking issue for the feature: https://github.com/rust-lang/rust/issues/15872
2018-10-01Rollup merge of #53784 - tbu-:pr_doc_slice_isize_max, r=RalfJungkennytm-3/+14
Document that slices cannot be larger than `isize::MAX` bytes Fixes #53676.
2018-09-30Simplify implementation of align_offset slightlySimonas Kazlauskas-1/+1
2018-09-29Use impl_header_lifetime_elision in libcoreScott McMurray-48/+48
2018-09-29Revert "Auto merge of #53508 - japaric:maybe-uninit, r=RalfJung"Ralf Jung-10/+16
This reverts commit c6e3d7fa3113aaa64602507f39d4627c427742ff, reversing changes made to 4591a245c7eec9f70d668982b1383cd2a6854af5.
2018-09-27Don't have two adjacent "see also" sentencesTobias Bucher-3/+1
2018-09-25Rollup merge of #54537 - sdroege:chunks-exact, r=alexcrichtonPietro Albini-52/+52
Rename slice::exact_chunks() to slice::chunks_exact() See https://github.com/rust-lang/rust/issues/47115#issuecomment-403090815 and https://github.com/rust-lang/rust/issues/47115#issuecomment-424053547
2018-09-25Also rename ExactChunks iterator name to ChunksExactSebastian Dröge-25/+25
2018-09-24Rename slice::exact_chunks() to slice::chunks_exact()Sebastian Dröge-29/+29
See https://github.com/rust-lang/rust/issues/47115#issuecomment-403090815 and https://github.com/rust-lang/rust/issues/47115#issuecomment-424053547
2018-09-23Introduce the partition_dedup/by/by_key methods for slicesClément Renault-0/+172
2018-09-22address Mark-Simulacrum commentsJorge Aparicio-9/+6
2018-09-22core: fix deprecated warningsJorge Aparicio-13/+10