about summary refs log tree commit diff
path: root/library/alloc
AgeCommit message (Collapse)AuthorLines
2020-08-30Rollup merge of #75874 - pickfire:patch-3, r=jyn514Dylan DPC-3/+1
Shorten liballoc doc intra link while readable r? @jyn514 Do you want to reviews these sort of pull requests in the future? I might send a few of them while reading vec code.
2020-08-29Remove empty vec assertion flow distruptIvan Tham-1/+0
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-29Reuse description from drain_filterIvan Tham-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-29Use explicit intra-doc link in path for Vec resizeIvan Tham-3/+1
2020-08-29Vec slice example fix style and show type elisionIvan Tham-1/+1
2020-08-29Link vec doc to & referenceIvan Tham-1/+1
It is not always obvious that people could see the docs for `&` especially for beginners, it also helps learnability.
2020-08-29Use assertions on Vec docIvan Tham-2/+4
Clarify what the state of Vec after with_capacity on doc.
2020-08-29Add more info for Vec Drain docIvan Tham-0/+1
See its documentation for more
2020-08-29Remove brackets in drain filter docsIvan Tham-1/+1
2020-08-29Keep doc standard for Vec DrainFilterIvan Tham-1/+4
2020-08-29Liballoc vec doc use associated functionIvan Tham-0/+2
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-29typomental-1/+1
Co-authored-by: Andrew Hickman <andrew.hickman1@sky.com>
2020-08-28Add missing hyphenCamelid-1/+1
reference counted pointer -> reference-counted pointer
2020-08-28Liballoc extend use intra doc linkIvan Tham-2/+0
2020-08-27Add PartialEq impls for Vec <-> sliceMatt Brubeck-1/+4
2020-08-27`impl Rc::new_cyclic`mental32-0/+100
2020-08-27Rollup merge of #75875 - pickfire:patch-4, r=jyn514Dylan DPC-5/+3
Shorten liballoc vec resize intra-doc link r? @jyn514
2020-08-26Auto merge of #75687 - TimDiekmann:realloc-align, r=Amanieubors-40/+66
Allow reallocation to different alignment in `AllocRef` The allocator-wg [has decided](https://github.com/rust-lang/wg-allocators/issues/5#issuecomment-672591112) to support reallocating to a different alignment in `AllocRef`. For more details please see the linked issue. r? @Amanieu closes https://github.com/rust-lang/wg-allocators/issues/5
2020-08-24Add more information to safety commentdylni-1/+3
2020-08-24Use translated variable for test stringIvan Tham-2/+2
Test should be educative, added english translation and pronounciation.
2020-08-24Shorten liballoc vec resize intra-doc linkIvan Tham-5/+3
2020-08-24Shorten liballoc doc intra link while readableIvan Tham-3/+1
2020-08-24Auto merge of #75815 - jyn514:ambiguous-primitives, r=guillaumegomezbors-5/+7
Report an ambiguity if both modules and primitives are in scope for intra-doc links Closes https://github.com/rust-lang/rust/issues/75381 - Add a new `prim@` disambiguator, since both modules and primitives are in the same namespace - Refactor `report_ambiguity` into a closure Additionally, I noticed that rustdoc would previously allow `[struct@char]` if `char` resolved to a primitive (not if it had a DefId). I fixed that and added a test case. I also need to update libstd to use `prim@char` instead of `type@char`. If possible I would also like to refactor `ambiguity_error` to use `Disambiguator` instead of its own hand-rolled match - that ran into issues with `prim@` (I updated one and not the other) and it would be better for them to be in sync.
2020-08-24Auto merge of #75505 - Dylan-DPC:feature/arc_new, r=KodrAusbors-4/+147
Add Arc::new_cyclic Rework of #72443 References #75861 cc @Diggsey @RalfJung r? @KodrAus
2020-08-24Rollup merge of #75831 - lzutao:https, r=Dylan-DPCYuki Okushi-3/+3
doc: Prefer https link for wikipedia URLs A tiny changes.
2020-08-23Convert from str -> prim@str for `alloc`Joshua Nelson-5/+7
2020-08-24add issue numberDylan DPC-1/+1
2020-08-23Auto merge of #74238 - RalfJung:offset_from, r=oli-obkbors-1/+0
stabilize ptr_offset_from This stabilizes ptr::offset_from, and closes https://github.com/rust-lang/rust/issues/41079. It also removes the deprecated `wrapping_offset_from`. This function was deprecated 19 days ago and was never stable; given an FCP of 10 days and some waiting time until FCP starts, that leaves at least a month between deprecation and removal which I think is fine for a nightly-only API. Regarding the open questions in https://github.com/rust-lang/rust/issues/41079: * Should offset_from abort instead of panic on ZSTs? -- As far as I know, there is no precedent for such aborts. We could, however, declare this UB. Given that the size is always known statically and the check thus rather cheap, UB seems excessive. * Should there be more methods like this with different restrictions (to allow nuw/nsw, perhaps) or that return usize (like how isize-taking offset is more conveniently done with usize-taking add these days)? -- No reason to block stabilization on that, we can always add such methods later. Also nominating the lang team because this exposes an intrinsic. The stabilized method is best described [by its doc-comment](https://github.com/RalfJung/rust/blob/56d4b2d69abb93e4f0ca79471deca7aaaaeca214/src/libcore/ptr/const_ptr.rs#L227). The documentation forgot to mention the requirement that both pointers must "have the same provenance", aka "be derived from pointers to the same allocation", which I am adding in this PR. This is a precondition that [Miri already implements](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a3b9d0a07a01321f5202cd99e9613480) and that, should LLVM ever obtain a `psub` operation to subtract pointers, will likely be required for that operation (following the semantics in [this paper](https://people.mpi-sws.org/~jung/twinsem/twinsem.pdf)).
2020-08-23Prefer https link for wikipedia URLsLzu Tao-3/+3
2020-08-22Auto merge of #75171 - amosonn:new_zeroed_slice, r=Amanieubors-30/+139
New zeroed slice Add to #63291 the methods ```rust impl<T> Box<[T]> { pub fn new_zeroed_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} } impl<T> Rc<[T]> { pub fn new_zeroed_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} } impl<T> Arc<[T]> { pub fn new_zeroed_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} } ``` as suggested in https://github.com/rust-lang/rust/issues/63291#issuecomment-605511675 . Also optimize `{Rc, Arc}::new_zeroed` to use `alloc_zeroed`, otherwise they are no more efficient than using `new_uninit` and zeroing the memory manually (which was the original implementation).
2020-08-22stabilize ptr_offset_fromRalf Jung-1/+0
2020-08-22Reduce duplicate in liballoc reserve error handlingIvan Tham-15/+13
2020-08-22Rollup merge of #75725 - LeSeulArtichaut:alloc-intra-doc, r=jyn514Dylan DPC-223/+116
Use intra-doc-links in `alloc` I didn't have time to test this, so I will let the CI do it for me. r? @jyn514 cc #75080
2020-08-21Update rc.rsamosonn-1/+1
2020-08-21Apply suggestions from code reviewLeSeulArtichaut-14/+6
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-21Use intra-doc-links in `alloc`LeSeulArtichaut-220/+121
2020-08-20Rollup merge of #75733 - pickfire:patch-3, r=matkladJosh Stone-64/+15
Remove duplicated alloc vec bench push_all_move push_all_move is the same as extend
2020-08-20Rollup merge of #75672 - kofls:intradoc-fix, r=jyn514Josh Stone-48/+30
Move to intra-doc links for task.rs and vec.rs Partial fix for #75080 links for [`get`], [`get_mut`] skipped due to #75643 link for [`copy_from_slice`] skipped due to #63351
2020-08-20Liballoc bench rename push_all extend_from_sliceIvan Tham-15/+15
2020-08-20Assume same alignment in `RawVec`Tim Diekmann-1/+6
2020-08-20Remove duplicated alloc vec bench push_all_moveIvan Tham-49/+0
push_all_move is the same as extend
2020-08-20Add debug assertion for equal alignment in RawVecTim Diekmann-0/+1
2020-08-19BTreeMap: introduce marker::ValMut and reserve marker::Mut for unique accessStein Somers-171/+319
2020-08-19Auto merge of #75480 - ssomers:btree_check_invariant, r=Mark-Simulacrumbors-41/+302
BTreeMap: check some invariants in unit tests
2020-08-19Apply suggestions from code reviewSurya Midatala-13/+12
2020-08-19Allow reallocation to different alignmentTim Diekmann-41/+61
2020-08-19Auto merge of #75677 - cuviper:shrink-towel, r=Mark-Simulacrumbors-1/+4
Don't panic in Vec::shrink_to_fit We can help the compiler see that `Vec::shrink_to_fit` will never reach the panic case in `RawVec::shrink_to_fit`, just by guarding the call only for cases where the capacity is strictly greater. A capacity less than the length is only possible through an unsafe call to `set_len`, which would break the `Vec` invariants, so `shrink_to_fit` can just ignore that. This removes the panicking code from the examples in both #71861 and #75636.
2020-08-18Don't panic in Vec::shrink_to_fitJosh Stone-1/+4
2020-08-18Move to intra-doc links for task.rs and vec.rsSurya Midatala-36/+19
2020-08-18Make `grow_impl` unsafeTim Diekmann-3/+6