about summary refs log tree commit diff
path: root/src/liballoc/rc.rs
AgeCommit message (Collapse)AuthorLines
2019-08-17Rename private helper method allocate_for_unsized to allocate_for_layoutSimon Sapin-5/+5
2019-08-17Doc nitsSimon Sapin-5/+5
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-08-16Relax the safety condition for get_mut_uncheckedSimon Sapin-2/+4
2019-08-16Reuse more internal Rc and Arc methodsSimon Sapin-35/+7
2019-08-16Add a comment on the usage of Layout::new::<RcBox<()>>()Simon Sapin-0/+2
2019-08-16Add tracking issue numbersSimon Sapin-5/+5
2019-08-16Use ManuallyDrop instead of mem::forgetSimon Sapin-6/+2
Per https://github.com/rust-lang/rust/pull/62451#discussion_r303197278
2019-08-16Fix intra-rustdoc linksSimon Sapin-1/+5
2019-08-16Move constructors of boxed/rc’ed slices to matching `impl` blocksSimon Sapin-45/+47
2019-08-16Add new_uninit_slice and assume_init on Box, Rc, and Arc of [T]Simon Sapin-5/+93
2019-08-16Add new_uninit and assume_init on Box, Rc, and ArcSimon Sapin-0/+81
2019-08-16Add Rc::get_mut_unchecked, Arc::get_mut_uncheckedSimon Sapin-1/+30
2019-08-05Add implementations for converting boxed slices into boxed arraysJake Goulding-1/+18
This mirrors the implementations of reference slices into arrays.
2019-08-02liballoc: Unconfigure tests during normal buildVadim Petrochenkov-430/+3
Remove additional libcore-like restrictions from liballoc, turns out the testing works ok if the tests are a part of liballoc itself.
2019-07-18Fix clippy::clone_on_copy warningsMateusz Mikuła-1/+1
2019-07-13Auto merge of #61953 - Centril:shared-from-iter, r=RalfJungbors-74/+213
Add `impl<T> FromIterator<T> for Arc/Rc<[T]>` Add implementations of `FromIterator<T> for Arc/Rc<[T]>` with symmetrical logic. This also takes advantage of specialization in the case of iterators with known length (`TrustedLen`) to elide the final allocation/copying from a `Vec<T>` into `Rc<[T]>` because we can allocate the space for the `Rc<[T]>` directly when the size is known. This is the primary motivation and why this is to be preferred over `iter.collect::<Vec<_>>().into(): Rc<[T]>`. Moreover, this PR does some refactoring in some places. r? @RalfJung for the code cc @alexcrichton from T-libs
2019-07-06Rollup merge of #61862 - vorner:weak-into-raw-methods, r=sfacklerMazdak Farrokhzad-15/+15
Make the Weak::{into,as}_raw methods Because Weak doesn't Deref, so there's no reason for them to be only associated methods. As kindly pointed out here https://github.com/rust-lang/rust/pull/60766#issuecomment-501706422 by @chpio.
2019-06-21shared_from_iter: Polish internal docs.Mazdak Farrokhzad-14/+15
2019-06-20shared_from_iter: Clarify slice::Iter specialization impl.Mazdak Farrokhzad-2/+8
2019-06-20data_offset_align: add inline attribute.Mazdak Farrokhzad-0/+1
2019-06-20deduplicate slice_from_raw_parts_mut.Mazdak Farrokhzad-17/+1
2019-06-20shared_from_iter/Rc: Use specialization to elide allocation.Mazdak Farrokhzad-39/+167
2019-06-20Rc: reduce duplicate calls.Mazdak Farrokhzad-4/+8
2019-06-20Rc: refactor data_offset{_sized}.Mazdak Farrokhzad-6/+7
2019-06-20Rc: refactor away PhantomData noise.Mazdak Farrokhzad-23/+30
2019-06-20Add basic 'shared_from_iter' impls.Mazdak Farrokhzad-0/+7
2019-06-16make `Weak::ptr_eq`s into methodsThomas Heck-7/+7
2019-06-15Make the Weak::{into,as}_raw methodsMichal 'vorner' Vaner-15/+15
Because Weak doesn't Deref, so there's no reason for them to be only associated methods.
2019-06-14Auto merge of #61421 - vorner:string-in-rc-into-raw-docs, r=RalfJungbors-14/+14
docs: Use String in Rc::into_raw examples It is unclear if accessing an integer after `drop_in_place` has been called on it is undefined behaviour or not, as demonstrated by the discussion in https://github.com/rust-lang/rust/pull/60766#pullrequestreview-243414222. Avoid these uncertainties by using String which frees memory in its `drop_in_place` to make sure this is undefined behaviour. The message in the docs should be to watch out and not access the data after that, not discussing when one maybe could get away with it O:-).
2019-06-13docs: Use String in Rc::into_raw examplesMichal 'vorner' Vaner-14/+14
It is unclear if accessing an integer after `drop_in_place` has been called on it is undefined behaviour or not, as demonstrated by the discussion in https://github.com/rust-lang/rust/pull/60766#pullrequestreview-243414222. Avoid these uncertainties by using String which frees memory in its `drop_in_place` to make sure this is undefined behaviour. The message in the docs should be to watch out and not access the data after that, not discussing when one maybe could get away with it O:-).
2019-06-04Rollup merge of #61135 - czipperz:rc-make_mut-weak-doc, r=Mark-SimulacrumMazdak Farrokhzad-7/+27
Fix documentation of `Rc::make_mut` regarding `rc::Weak`. Closes #60961
2019-05-26rc::Weak::{as,from,into}_rawMichal 'vorner' Vaner-6/+156
Methods on the Weak to access it as a raw pointer to the data.
2019-05-24Remove unused import in doctestChris Gregory-1/+1
2019-05-24Reword `are not other` to `are no other`Chris Gregory-1/+1
Co-Authored-By: Jonas Schievink <jonasschievink@gmail.com>
2019-05-24Fix documentation of `Rc::make_mut` regarding `rc::Weak`.Chris Gregory-7/+27
2019-05-11add comment to `Rc`/`Arc`'s `Eq` specializationThomas Heck-0/+5
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-2/+2
2019-02-10libs: doc commentsAlexander Regueiro-5/+5
2019-02-03liballoc: revert nested imports style changes.Mazdak Farrokhzad-34/+30
2019-02-02liballoc: fix some idiom lints.Mazdak Farrokhzad-4/+4
2019-02-02liballoc: adjust abolute imports + more import fixes.Mazdak Farrokhzad-2/+1
2019-02-02liballoc: refactor & fix some imports.Mazdak Farrokhzad-32/+33
2019-02-02liballoc: cargo check passes on 2018Mazdak Farrokhzad-4/+4
2019-01-31Auto merge of #56696 - jonas-schievink:weak-counts, r=alexcrichtonbors-0/+59
Implement Weak::{strong_count, weak_count} The counters are also useful on `Weak`, not just on strong references (`Rc` or `Arc`). In situations where there are still strong references around, you can also get these counts by temporarily upgrading and adjusting the values accordingly. Using the methods introduced here is simpler to do, less error-prone (since you can't forget to adjust the counts), can also be used when no strong references are around anymore, and might be more efficient due to not having to temporarily create an `Rc`. This is mainly useful in assertions or tests of complex data structures. Data structures might have internal invariants that make them the sole owner of a `Weak` pointer, and an assertion on the weak count could be used to ensure that this indeed happens as expected. Due to the presence of `Weak::upgrade`, the `strong_count` becomes less useful, but it still seems worthwhile to mirror the API of `Rc`. TODO: * [X] Tracking issue - https://github.com/rust-lang/rust/issues/57977 Closes https://github.com/rust-lang/rust/issues/50158
2019-01-31Rollup merge of #57934 - dwijnand:from-Arc/Rc-to-NonNull, r=alexcrichtonMazdak Farrokhzad-0/+21
Introduce into_raw_non_null on Rc and Arc None
2019-01-29Add tracking issue to unstable attributeJonas Schievink-2/+2
2019-01-29Make weak_count return an Option<usize>Jonas Schievink-14/+12
2019-01-29Implement Weak::{strong_count, weak_count}Jonas Schievink-0/+61
2019-01-28Introduce into_raw_non_null on Rc and ArcDale Wijnand-0/+21
2019-01-28liballoc: remove unneeded allow(deprecated)Ralf Jung-2/+0