about summary refs log tree commit diff
path: root/library/alloc
AgeCommit message (Collapse)AuthorLines
2020-09-07Auto merge of #76368 - ayushmishra2005:move_str_contact_library, r=jyn514bors-0/+8
Added str tests in library Added str tests in library as a part of #76268 r? @matklad
2020-09-07Typo fix scottmcm-1/+1
Thanks, Amanieu Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2020-09-07Rollup merge of #76324 - ayushmishra2005:move_vec_tests_in_library, r=matkladDylan DPC-0/+23
Move Vec slice UI tests in library Moved some of Vec slice UI tests in Library as a part of #76268 r? @matklad
2020-09-07Rollup merge of #76305 - CDirkx:const-tests, r=matkladDylan DPC-0/+14
Move various ui const tests to `library` Move: - `src\test\ui\consts\const-nonzero.rs` to `library\core` - `src\test\ui\consts\ascii.rs` to `library\core` - `src\test\ui\consts\cow-is-borrowed` to `library\alloc` Part of #76268 r? @matklad
2020-09-07Rollup merge of #76303 - jyn514:vec-assert-doc, r=Dylan-DPCDylan DPC-0/+3
Link to `#capacity-and-reallocation` when using with_capacity Follow up to https://github.com/rust-lang/rust/pull/76058#discussion_r479655750. r? @pickfire
2020-09-07Rollup merge of #76273 - CraftSpider:master, r=matkladDylan DPC-0/+56
Move some Vec UI tests into alloc unit tests A bit of work towards #76268, makes a number of the Vec UI tests that are simply running code into unit tests. Ensured that they are being run when testing liballoc locally.
2020-09-06Clean up vec benches bench_in_place styleIvan Tham-22/+21
2020-09-06Move test-cases in string.rsAyush Kumar Mishra-8/+8
2020-09-05Auto merge of #76217 - RalfJung:maybe-uninit-slice, r=KodrAusbors-11/+15
rename MaybeUninit slice methods The `first` methods conceptually point to the whole slice, not just its first element, so rename them to be consistent with the raw ptr methods on ref-slices. Also, do the equivalent of https://github.com/rust-lang/rust/pull/76047 for the slice reference getters, and make them part of https://github.com/rust-lang/rust/issues/63569 (so far they somehow had no tracking issue). * first_ptr -> slice_as_ptr * first_ptr_mut -> slice_as_mut_ptr * slice_get_ref -> slice_assume_init_ref * slice_get_mut -> slice_assume_init_mut
2020-09-05Nightly is currently 1.48scottmcm-1/+1
2020-09-05rename MaybeUninit slice methodsRalf Jung-11/+15
first_ptr -> slice_as_ptr first_ptr_mut -> slice_as_mut_ptr slice_get_ref -> slice_assume_init_ref slice_get_mut -> slice_assume_init_mut
2020-09-05Rollup merge of #76060 - pickfire:patch-12, r=jyn514Dylan DPC-1/+3
Link vec doc to & reference It is not always obvious that people could see the docs for `&` especially for beginners, it also helps learnability.
2020-09-05Rollup merge of #75994 - mental32:impl-rc-new-cyclic, r=KodrAusDylan DPC-0/+110
`impl Rc::new_cyclic` References #75861 r? @Dylan-DPC
2020-09-05Move Various str tests in libraryAyush Kumar Mishra-0/+21
2020-09-05Added str tests in libraryAyush Kumar Mishra-0/+8
2020-09-04Re-export ArrayChunksMut in allocJosh Stone-0/+2
2020-09-04Auto merge of #75200 - ssomers:btree_valmut, r=Mark-Simulacrumbors-171/+319
BTreeMap: introduce marker::ValMut and reserve Mut for unique access The mutable BTreeMap iterators (apart from `DrainFilter`) are double-ended, meaning they have to rely on a front and a back handle that each represent a reference into the tree. Reserve a type category `marker::ValMut` for them, so that we guarantee that they cannot reach operations on handles with borrow type `marker::Mut`and that these operations can assume unique access to the tree. Including #75195, benchmarks report no genuine change: ``` benchcmp old new --threshold 5 name old ns/iter new ns/iter diff ns/iter diff % speedup btree::map::iter_100 3,333 3,023 -310 -9.30% x 1.10 btree::map::range_unbounded_vs_iter 36,624 31,569 -5,055 -13.80% x 1.16 ``` r? @Mark-Simulacrum
2020-09-04Auto merge of #75207 - dylni:add-slice-check-range, r=KodrAusbors-71/+22
Add `slice::check_range` This method is useful for [`RangeBounds`] parameters. It's even been [rewritten](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/src/librustc_data_structures/sorted_map.rs#L214) [many](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/alloc/src/vec.rs#L1299) [times](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/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-04Move Vec slice UI tests in libraryAyush Kumar Mishra-0/+23
2020-09-03Add `[T; N]: TryFrom<Vec<T>>`Scott McMurray-0/+52
This is very similar to the existing `Box<[T; N]>: TryFrom<Box<[T]>>`, but allows avoiding the `shrink_to_fit` if you have a vector and not a boxed slice.
2020-09-04Add slice primitive link to vecIvan Tham-1/+2
2020-09-04Move various ui const tests to `library`Christiaan Dirkx-0/+14
Move: - `src\test\ui\consts\const-nonzero.rs` to `library\core` - `src\test\ui\consts\ascii.rs` to `library\core` - `src\test\ui\consts\cow-is-borrowed` to `library\alloc` Part of #76268
2020-09-04Add tests for overflow in String / VecDeque operations using rangesTomasz Miąsko-0/+45
2020-09-04Add tests for overflow in Vec::drainTomasz Miąsko-0/+25
2020-09-03Link to `#capacity-and-reallocation` when using with_capacityJoshua Nelson-0/+3
2020-09-03fix debug assertionThe8472-4/+18
The InPlaceIterable debug assert checks that the write pointer did not advance beyond the read pointer. But TrustedRandomAccess never advances the read pointer, thus triggering the assert. Skip the assert if the source pointer did not change during iteration.
2020-09-03Remove vec-to_str.rs, merge the remaining test in with vecRune Tynan-0/+3
2020-09-03improve comments and namingThe8472-25/+56
2020-09-03add explanation to specialization markerThe8472-0/+6
2020-09-03remove separate no-drop code path since it resulted in more LLVM IRThe8472-32/+15
2020-09-03remove empty Vec extend optimizationThe8472-24/+2
The optimization meant that every extend code path had to emit llvm IR for from_iter and extend spec_extend, which likely impacts compile times while only improving a few edge-cases
2020-09-03get things to work under min_specialization by leaning more heavily on ↵The8472-8/+14
#[rustc_unsafe_specialization_marker]
2020-09-03fix benchmark compile errorsThe8472-12/+9
2020-09-03apply required min_specialization attributesThe8472-1/+7
2020-09-03support in-place collect for MapWhile adaptersThe8472-0/+2
2020-09-03generalize in-place collect to types of same size and alignmentThe8472-23/+34
2020-09-03increase comment verbosityThe8472-2/+2
2020-09-03work around compiler overhead around lambdas in generics by extracting them ↵The8472-34/+39
into free functions
2020-09-03extract IntoIter drop/forget used by specialization into separate methodsThe8472-15/+25
2020-09-03add benchmark to cover in-place extendThe8472-0/+14
2020-09-03remove redundant castThe8472-1/+1
2020-09-03test drops during in-place iterationThe8472-0/+40
2020-09-03move unsafety into method, not relevant to callerThe8472-2/+2
2020-09-03replace unsafe ptr::write with deref-write, benchmarks show no differenceThe8472-10/+4
2020-09-03pacify tidyThe8472-6/+6
2020-09-03replace drop flag with ManuallyDropThe8472-6/+4
2020-09-03mark as_inner as unsafe and update commentsThe8472-5/+9
2020-09-03avoid exposing that binary heap's IntoIter is backed by vec::IntoIter, use a ↵The8472-9/+26
private trait instead
2020-09-03fix: bench didn't black_box its resultsThe8472-3/+1
2020-09-03fix build issue due to stabilized featureThe8472-0/+1