about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2017-10-22Remove deprecated `collections` crate.leonardo.yvens-80/+0
This reverts commit 6484258f1749499d3e51685df867b3d460a7f0be.
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-2/+0
Fixes #41701.
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-2/+0
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-30Revert "Stabilize RangeArgument"Steven Fackler-1/+0
This reverts commit 143206d54d7558c2326212df99efc98110904fdb.
2017-06-24Stabilize RangeArgumentSteven Fackler-0/+1
Move it and Bound to core::ops while we're at it. Closes #30877
2017-06-17Reintroduce deprecated `collections` crateMurarth-0/+84
2017-06-13Merge crate `collections` into `alloc`Murarth-29899/+0
2017-06-13Rollup merge of #42428 - scottmcm:str-get-overflow, r=sfacklerCorey Farwell-0/+43
Add overflow checking for `str::get` with inclusive ranges Fixes https://github.com/rust-lang/rust/issues/42401 Two commits here: 1. The first makes `str::index` just call `SliceIndex<str>::index`. It's intended to have no behavior change, except where the two methods were inconsistent. 2. The second actually adds the overflow checking to `get(_mut)` (and tests for it)
2017-06-11Add missing term 'disjoint' from matches, rmatchesCampbell Barton-2/+2
This follows `match_indices`
2017-06-09Rollup merge of #42385 - Manishearth:its-a-vec, r=steveklabnikCorey Farwell-1/+1
Vec<T> is pronounced 'vec' I've never heard it pronounced "vector". Is this an outdated recommendation? (or have I been doing it wrong all this time) r? @steveklabnik
2017-06-04Add overflow checking for str::get with inclusive rangesScott McMurray-0/+43
Fixes #42401
2017-06-03 Improve doc example for `Cow::to_mut`.Corey Farwell-4/+7
2017-06-03Improve doc examples for `Cow::into_owned`.Corey Farwell-3/+22
2017-06-03Auto merge of #42331 - retep998:standard-relocation-coupon, r=alexcrichtonbors-0/+17
Improve reallocation in alloc_system on Windows Fixes https://github.com/rust-lang/rust/issues/42025
2017-06-02Vec<T> is pronounced 'vec'Manish Goregaokar-1/+1
2017-06-02Rollup merge of #42370 - mbrubeck:docs, r=frewsxcvMark Simulacrum-0/+2
Add [[T]] -> [T] examples to SliceConcatExt docs None
2017-06-02Rollup merge of #42310 - scottmcm:deprecate-range-stepby, r=alexcrichtonMark Simulacrum-2/+3
Deprecate range-specific `step_by` Deprecation attributes and test updates only. Was replaced by an any-iterator version in https://github.com/rust-lang/rust/pull/41439 Last follow-up (this release) to https://github.com/rust-lang/rust/pull/42110#issuecomment-303210138 r? @alexcrichton
2017-06-02Add test for vecs with overaligned dataPeter Atashian-0/+17
2017-06-02Auto merge of #41670 - scottmcm:slice-rotate, r=alexcrichtonbors-0/+134
Add an in-place rotate method for slices to libcore A helpful primitive for moving chunks of data around inside a slice. For example, if you have a range selected and are drag-and-dropping it somewhere else (Example from [Sean Parent's talk](https://youtu.be/qH6sSOr-yk8?t=560)). (If this should be an RFC instead of a PR, please let me know.) Edit: changed example
2017-06-01Add [[T]] -> [T] examples to SliceConcatExt docsMatt Brubeck-0/+2
2017-06-01tests: fix fallout from empowering unused_allocation in comparisons.Eduard-Mihai Burtescu-6/+6
2017-05-31Avoid range::step_by in another testScott McMurray-2/+3
2017-05-27Rollup merge of #42260 - stjepang:document-cmp-traits-agreement, r=alexcrichtonMark Simulacrum-1/+4
Docs: impls of PartialEq/PartialOrd/Ord must agree Fixes #41270. This PR brings two improvements to the docs: 1. Docs for `PartialEq`, `PartialOrd`, and `Ord` clarify that their implementations must agree. 2. Fixes a subtle bug in the Dijkstra example for `BinaryHeap`, where the impls are inconsistent. Thanks @Rufflewind for spotting the bug! r? @alexcrichton cc @frankmcsherry
2017-05-27Docs: impls of PartialEq/PartialOrd/Ord must agreeStjepan Glavina-1/+4
2017-05-27Stabilize unions with `Copy` fields and no destructorVadim Petrochenkov-1/+0
2017-05-26Rollup merge of #42236 - citizen428:docs/unchecked-indexing-slicing, ↵Corey Farwell-2/+23
r=GuillaumeGomez Update documentation for indexing/slicing methods See #39911 r? @steveklabnik
2017-05-26Rollup merge of #42215 - callahad:remove-superfluous-semis, r=Mark-SimulacrumCorey Farwell-1/+1
Remove superfluous `;;` sequences Ran across a doubled `;;` in the docstring for `str::split`. Grep found a few more. :)
2017-05-26Update documentation for indexing/slicing methodsMichael Kohl-2/+23
See #39911
2017-05-24Remove superfluous `;;` sequencesDan Callahan-1/+1
2017-05-24Rollup merge of #42134 - scottmcm:rangeinclusive-struct, r=aturonMark Simulacrum-8/+2
Make RangeInclusive just a two-field struct Not being an enum improves ergonomics and consistency, especially since NonEmpty variant wasn't prevented from being empty. It can still be iterable without an extra "done" bit by making the range have !(start <= end), which is even possible without changing the Step trait. Implements merged https://github.com/rust-lang/rfcs/pull/1980; tracking issue https://github.com/rust-lang/rust/issues/28237. This is definitely a breaking change to anything consuming `RangeInclusive` directly (not as an Iterator) or constructing it without using the sugar. Is there some change that would make sense before this so compilation failures could be compatibly fixed ahead of time? r? @aturon (as FCP proposer on the RFC)
2017-05-22Slice::into_vec: Don't link to Vec::into_boxed_sliceColin Wallace-3/+1
The documentation for this method appears on multiple different pages, which causes the relative links to not always work.
2017-05-22Mention Vec::into_boxed_slice in docs for [T]::into_vec.Colin Wallace-0/+5
`Vec::into_boxed_slice` and `[T]::into_vec` are inverses, so it makes sense to mention the other in their respective documentation for visibility. `Vec::into_boxed_slice` already mentions `[T]::into_vec`, but not the other way around until now.
2017-05-21Auto merge of #41904 - sfackler:1.18-stabilization, r=alexcrichtonbors-2/+1
Stabilize library features for 1.18.0 Closes #38863 Closes #38980 Closes #38903 Closes #36648 r? @alexcrichton @rust-lang/libs
2017-05-21Stop returning k from [T]::rotateScott McMurray-9/+8
2017-05-21Tweak comment wordingScott McMurray-2/+2
2017-05-21Update slice_rotate to a real tracking numberScott McMurray-1/+1
2017-05-21Change the doctest example to slideScott McMurray-9/+12
Batch-insert is better done with Vec::splice
2017-05-21Add an in-place rotate method for slices to libcoreScott McMurray-0/+132
A helpful primitive for moving chunks of data around inside a slice. In particular, adding elements to the end of a Vec then moving them somewhere else, as a way to do efficient multiple-insert. (There's drain for efficient block-remove, but no easy way to block-insert.) Talk with another example: <https://youtu.be/qH6sSOr-yk8?t=560>
2017-05-21Make RangeInclusive just a two-field structScott McMurray-8/+2
Not being an enum improves ergonomics, especially since NonEmpty could be Empty. It can still be iterable without an extra "done" bit by making the range have !(start <= end), which is even possible without changing the Step trait. Implements RFC 1980
2017-05-20Stabilize library features for 1.18.0Steven Fackler-2/+1
Closes #38863 Closes #38980 Closes #38903 Closes #36648
2017-05-20Auto merge of #42111 - ollie27:stab, r=Mark-Simulacrumbors-12/+12
Correct some stability versions These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-05-20Correct some stability versionsOliver Middleton-12/+12
These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-05-19Rollup merge of #42037 - nagisa:charpat, r=sfacklerMark Simulacrum-6/+31
Minor optimisation of the string operations The interesting benchmarks are <table cellspacing="0" border="0"> <tr> <th height="17" align="right"><b> (&lt;100% → better than original )</b></th> <th align="left" sdnum="2057;0;0.00%">Delta</th> <th align="left">Original ns/i</th> <th align="left">This Patch ns/i</th> </tr> <tr> <td height="17" align="left">str::contains_bang_char::long_lorem_ipsum</td> <td align="right" sdval="0.249775381850854" sdnum="2057;0;0.00%">24.98%</td> <td align="right" sdval="5565" sdnum="2057;">5565</td> <td align="right" sdval="1390" sdnum="2057;">1390</td> </tr> <tr> <td height="17" align="left">str::contains_bang_char::short_ascii</td> <td align="right" sdval="0.277777777777778" sdnum="2057;0;0.00%">27.78%</td> <td align="right" sdval="144" sdnum="2057;">144</td> <td align="right" sdval="40" sdnum="2057;">40</td> </tr> <tr> <td height="17" align="left">str::contains_bang_char::short_mixed</td> <td align="right" sdval="0.333333333333333" sdnum="2057;0;0.00%">33.33%</td> <td align="right" sdval="120" sdnum="2057;">120</td> <td align="right" sdval="40" sdnum="2057;">40</td> </tr> <tr> <td height="17" align="left">str::contains_bang_char::short_pile_of_poo</td> <td align="right" sdval="0.594202898550725" sdnum="2057;0;0.00%">59.42%</td> <td align="right" sdval="69" sdnum="2057;">69</td> <td align="right" sdval="41" sdnum="2057;">41</td> </tr> <tr> <td height="17" align="left">str::ends_with_ascii_char::long_lorem_ipsum</td> <td align="right" sdval="0.452629649990837" sdnum="2057;0;0.00%">45.26%</td> <td align="right" sdval="5457" sdnum="2057;">5457</td> <td align="right" sdval="2470" sdnum="2057;">2470</td> </tr> <tr> <td height="17" align="left">str::ends_with_ascii_char::short_ascii</td> <td align="right" sdval="0.450054684651841" sdnum="2057;0;0.00%">45.01%</td> <td align="right" sdval="5486" sdnum="2057;">5486</td> <td align="right" sdval="2469" sdnum="2057;">2469</td> </tr> <tr> <td height="17" align="left">str::ends_with_ascii_char::short_mixed</td> <td align="right" sdval="0.463132795304475" sdnum="2057;0;0.00%">46.31%</td> <td align="right" sdval="5452" sdnum="2057;">5452</td> <td align="right" sdval="2525" sdnum="2057;">2525</td> </tr> <tr> <td height="17" align="left">str::ends_with_ascii_char::short_pile_of_poo</td> <td align="right" sdval="0.453426419254088" sdnum="2057;0;0.00%">45.34%</td> <td align="right" sdval="5443" sdnum="2057;">5443</td> <td align="right" sdval="2468" sdnum="2057;">2468</td> </tr> <tr> <td height="17" align="left">str::ends_with_unichar::long_lorem_ipsum</td> <td align="right" sdval="0.459385290889133" sdnum="2057;0;0.00%">45.94%</td> <td align="right" sdval="5466" sdnum="2057;">5466</td> <td align="right" sdval="2511" sdnum="2057;">2511</td> </tr> <tr> <td height="17" align="left">str::ends_with_unichar::short_ascii</td> <td align="right" sdval="0.460593841642229" sdnum="2057;0;0.00%">46.06%</td> <td align="right" sdval="5456" sdnum="2057;">5456</td> <td align="right" sdval="2513" sdnum="2057;">2513</td> </tr> <tr> <td height="17" align="left">str::ends_with_unichar::short_mixed</td> <td align="right" sdval="0.454976303317536" sdnum="2057;0;0.00%">45.50%</td> <td align="right" sdval="5486" sdnum="2057;">5486</td> <td align="right" sdval="2496" sdnum="2057;">2496</td> </tr> <tr> <td height="17" align="left">str::ends_with_unichar::short_pile_of_poo</td> <td align="right" sdval="0.456497797356828" sdnum="2057;0;0.00%">45.65%</td> <td align="right" sdval="5448" sdnum="2057;">5448</td> <td align="right" sdval="2487" sdnum="2057;">2487</td> </tr> <tr> <td height="17" align="left">str::find_underscore_char::long_lorem_ipsum</td> <td align="right" sdval="0.622058559367703" sdnum="2057;0;0.00%">62.21%</td> <td align="right" sdval="5567" sdnum="2057;">5567</td> <td align="right" sdval="3463" sdnum="2057;">3463</td> </tr> <tr> <td height="17" align="left">str::find_underscore_char::short_ascii</td> <td align="right" sdval="0.664383561643836" sdnum="2057;0;0.00%">66.44%</td> <td align="right" sdval="146" sdnum="2057;">146</td> <td align="right" sdval="97" sdnum="2057;">97</td> </tr> <tr> <td height="17" align="left">str::find_underscore_char::short_mixed</td> <td align="right" sdval="0.762295081967213" sdnum="2057;0;0.00%">76.23%</td> <td align="right" sdval="122" sdnum="2057;">122</td> <td align="right" sdval="93" sdnum="2057;">93</td> </tr> <tr> <td height="17" align="left">str::find_underscore_str::short_pile_of_poo</td> <td align="right" sdval="0.476190476190476" sdnum="2057;0;0.00%">47.62%</td> <td align="right" sdval="252" sdnum="2057;">252</td> <td align="right" sdval="120" sdnum="2057;">120</td> </tr> <tr> <td height="17" align="left">str::find_zzz_char::long_lorem_ipsum</td> <td align="right" sdval="0.621655593463818" sdnum="2057;0;0.00%">62.17%</td> <td align="right" sdval="5569" sdnum="2057;">5569</td> <td align="right" sdval="3462" sdnum="2057;">3462</td> </tr> <tr> <td height="17" align="left">str::find_zzz_char::short_ascii</td> <td align="right" sdval="0.666666666666667" sdnum="2057;0;0.00%">66.67%</td> <td align="right" sdval="147" sdnum="2057;">147</td> <td align="right" sdval="98" sdnum="2057;">98</td> </tr> <tr> <td height="17" align="left">str::find_zzz_char::short_mixed</td> <td align="right" sdval="0.754098360655738" sdnum="2057;0;0.00%">75.41%</td> <td align="right" sdval="122" sdnum="2057;">122</td> <td align="right" sdval="92" sdnum="2057;">92</td> </tr> <tr> <td height="17" align="left">str::find_zzz_str::long_lorem_ipsum</td> <td align="right" sdval="0.728648648648649" sdnum="2057;0;0.00%">72.86%</td> <td align="right" sdval="925" sdnum="2057;">925</td> <td align="right" sdval="674" sdnum="2057;">674</td> </tr> <tr> <td height="17" align="left">str::rfind_underscore_char::long_lorem_ipsum</td> <td align="right" sdval="0.3418911335578" sdnum="2057;0;0.00%">34.19%</td> <td align="right" sdval="7128" sdnum="2057;">7128</td> <td align="right" sdval="2437" sdnum="2057;">2437</td> </tr> <tr> <td height="17" align="left">str::rfind_underscore_char::short_ascii</td> <td align="right" sdval="0.373056994818653" sdnum="2057;0;0.00%">37.31%</td> <td align="right" sdval="193" sdnum="2057;">193</td> <td align="right" sdval="72" sdnum="2057;">72</td> </tr> <tr> <td height="17" align="left">str::rfind_underscore_char::short_mixed</td> <td align="right" sdval="0.414201183431953" sdnum="2057;0;0.00%">41.42%</td> <td align="right" sdval="169" sdnum="2057;">169</td> <td align="right" sdval="70" sdnum="2057;">70</td> </tr> <tr> <td height="17" align="left">str::rfind_underscore_char::short_pile_of_poo</td> <td align="right" sdval="0.505050505050505" sdnum="2057;0;0.00%">50.51%</td> <td align="right" sdval="99" sdnum="2057;">99</td> <td align="right" sdval="50" sdnum="2057;">50</td> </tr> <tr> <td height="17" align="left">str::rfind_zzz_char::long_lorem_ipsum</td> <td align="right" sdval="0.341983447888904" sdnum="2057;0;0.00%">34.20%</td> <td align="right" sdval="7129" sdnum="2057;">7129</td> <td align="right" sdval="2438" sdnum="2057;">2438</td> </tr> <tr> <td height="17" align="left">str::rfind_zzz_char::short_ascii</td> <td align="right" sdval="0.371134020618557" sdnum="2057;0;0.00%">37.11%</td> <td align="right" sdval="194" sdnum="2057;">194</td> <td align="right" sdval="72" sdnum="2057;">72</td> </tr> <tr> <td height="17" align="left">str::rfind_zzz_char::short_mixed</td> <td align="right" sdval="0.409356725146199" sdnum="2057;0;0.00%">40.94%</td> <td align="right" sdval="171" sdnum="2057;">171</td> <td align="right" sdval="70" sdnum="2057;">70</td> </tr> <tr> <td height="17" align="left">str::rfind_zzz_char::short_pile_of_poo</td> <td align="right" sdval="0.548076923076923" sdnum="2057;0;0.00%">54.81%</td> <td align="right" sdval="104" sdnum="2057;">104</td> <td align="right" sdval="57" sdnum="2057;">57</td> </tr> <tr> <td height="17" align="left">str::trim_right_ascii_char::short_mixed</td> <td align="right" sdval="1.10416666666667" sdnum="2057;0;0.00%">110.42%</td> <td align="right" sdval="48" sdnum="2057;">48</td> <td align="right" sdval="53" sdnum="2057;">53</td> </tr> <tr> <td height="17" align="left">string::bench_from</td> <td align="right" sdval="1.17241379310345" sdnum="2057;0;0.00%">117.24%</td> <td align="right" sdval="58" sdnum="2057;">58</td> <td align="right" sdval="68" sdnum="2057;">68</td> </tr> <tr> <td height="17" align="left">string::bench_from_str</td> <td align="right" sdval="1.17241379310345" sdnum="2057;0;0.00%">117.24%</td> <td align="right" sdval="58" sdnum="2057;">58</td> <td align="right" sdval="68" sdnum="2057;">68</td> </tr> <tr> <td height="17" align="left">string::bench_push_str</td> <td align="right" sdval="1.11111111111111" sdnum="2057;0;0.00%">111.11%</td> <td align="right" sdval="54" sdnum="2057;">54</td> <td align="right" sdval="60" sdnum="2057;">60</td> </tr> <tr> <td height="17" align="left">string::bench_to_string</td> <td align="right" sdval="1.12068965517241" sdnum="2057;0;0.00%">112.07%</td> <td align="right" sdval="58" sdnum="2057;">58</td> <td align="right" sdval="65" sdnum="2057;">65</td> </tr> <tr> <td height="17" align="left">string::from_utf8_lossy_100_invalid</td> <td align="right" sdval="1.1131458469588" sdnum="2057;0;0.00%">111.31%</td> <td align="right" sdval="1529" sdnum="2057;">1529</td> <td align="right" sdval="1702" sdnum="2057;">1702</td> </tr> </table>
2017-05-19Try to optimise char patternsSimonas Kazlauskas-6/+31
2017-05-16Auto merge of #41771 - clarcharr:resize_default, r=nikomatsakisbors-33/+95
Add Vec::resize_default. As suggested by #41758.
2017-05-12Remove some unused macros from the rust codebaseest31-12/+0
Removes unused macros from: * libcore * libcollections The last use of these two macros was removed in commit b64c9d56700e2c41207166fe8709711ff02488ff when the char_range_at_reverse function was been removed. * librustc_errors Their last use was removed by commits 2f2c3e178325dc1837badcd7573c2c0905fab979 and 11dc974a38fd533aa692cea213305056cd3a6902. * libsyntax_ext * librustc_trans Also, put the otry macro in back/msvc/mod.rs under the same cfg argument as the places that use it.
2017-05-11Add Vec::resize_default.Clar Charr-33/+95
2017-05-10Auto merge of #41764 - scottmcm:faster-reverse, r=brsonbors-0/+37
Make [u8]::reverse() 5x faster Since LLVM doesn't vectorize the loop for us, do unaligned reads of a larger type and use LLVM's bswap intrinsic to do the reversing of the actual bytes. cfg!-restricted to x86 and x86_64, as I assume it wouldn't help on things like ARMv5. Also makes [u16]::reverse() a more modest 1.5x faster by loading/storing u32 and swapping the u16s with ROT16. Thank you ptr::*_unaligned for making this easy :) Benchmark results (from my i5-2500K): ```text # Before test slice::reverse_u8 ... bench: 273,836 ns/iter (+/- 15,592) = 3829 MB/s test slice::reverse_u16 ... bench: 139,793 ns/iter (+/- 17,748) = 7500 MB/s test slice::reverse_u32 ... bench: 74,997 ns/iter (+/- 5,130) = 13981 MB/s test slice::reverse_u64 ... bench: 47,452 ns/iter (+/- 2,213) = 22097 MB/s # After test slice::reverse_u8 ... bench: 52,170 ns/iter (+/- 3,962) = 20099 MB/s test slice::reverse_u16 ... bench: 93,330 ns/iter (+/- 4,412) = 11235 MB/s test slice::reverse_u32 ... bench: 74,731 ns/iter (+/- 1,425) = 14031 MB/s test slice::reverse_u64 ... bench: 47,556 ns/iter (+/- 3,025) = 22049 MB/s ``` If you're curious about the assembly, instead of doing this ``` movzx eax, byte ptr [rdi] movzx ecx, byte ptr [rsi] mov byte ptr [rdi], cl mov byte ptr [rsi], al ``` it does this ``` mov rax, qword ptr [rdx] mov rbx, qword ptr [r11 + rcx - 8] bswap rbx mov qword ptr [rdx], rbx bswap rax mov qword ptr [r11 + rcx - 8], rax ```
2017-05-06Add links between `slice::{copy,clone}_from_slice` in docs.Corey Farwell-0/+9
2017-05-05Add reverse benchmarks for u128, [u8;3], and Simd<[f64;4]>Scott McMurray-6/+12
None of these are affected by e8fad325fe.