about summary refs log tree commit diff
path: root/src/liballoc/lib.rs
AgeCommit message (Collapse)AuthorLines
2020-03-26Fix issues from review and unsoundness of `RawVec::into_box`Tim Diekmann-0/+1
2020-03-26introduce `negative_impls` feature gate and documentNiko Matsakis-0/+1
They used to be covered by `optin_builtin_traits` but negative impls are now applicable to all traits, not just auto traits. This also adds docs in the unstable book for the current state of auto traits.
2020-03-23More explicit; CFG on atomic pointerWithout Boats-0/+1
2020-03-23Add Wake trait for safe construction of Wakers.Without Boats-0/+1
Currently, constructing a waker requires calling the unsafe `Waker::from_raw` API. This API requires the user to manually construct a vtable for the waker themself - which is both cumbersome and very error prone. This API would provide an ergonomic, straightforward and guaranteed memory-safe way of constructing a waker. It has been our longstanding intention that the `Waker` type essentially function as an `Arc<dyn Wake>`, with a `Wake` trait as defined here. Two considerations prevented the original API from being shipped as simply an `Arc<dyn Wake>`: - We want to support futures on embedded systems, which may not have an allocator, and in optimized executors for which this API may not be best-suited. Therefore, we have always explicitly supported the maximally-flexible (but also memory-unsafe) `RawWaker` API, and `Waker` has always lived in libcore. - Because `Waker` lives in libcore and `Arc` lives in liballoc, it has not been feasible to provide a constructor for `Waker` from `Arc<dyn Wake>`. Therefore, the Wake trait was left out of the initial version of the task waker API. However, as Rust 1.41, it is possible under the more flexible orphan rules to implement `From<Arc<W>> for Waker where W: Wake` in liballoc. Therefore, we can now define this constructor even though `Waker` lives in libcore. This PR adds these APIs: - A `Wake` trait, which contains two methods - A required method `wake`, which is called by `Waker::wake` - A provided method `wake_by_ref`, which is called by `Waker::wake_by_ref` and which implementors can override if they can optimize this use case. - An implementation of `From<Arc<W>> for Waker where W: Wake + Send + Sync + 'static` - A similar implementation of `From<Arc<W>> for RawWaker`.
2020-03-20Make std::sync::Arc compatible with ThreadSanitizerTomasz Miąsko-0/+1
The memory fences used previously in Arc implementation are not properly understood by ThreadSanitizer as synchronization primitives. This had unfortunate effect where running any non-trivial program compiled with `-Z sanitizer=thread` would result in numerous false positives. Replace acquire fences with acquire loads when using ThreadSanitizer to address the issue.
2020-01-30Add `#![doc(html_playground_url = ...)]` to alloc crateOliver Middleton-0/+1
This adds the Run button to code examples just like the core and std docs have.
2020-01-14Stabilize ptr::slice_from_raw_parts[_mut]CAD97-1/+0
2019-12-22Format the worldMark Rousskov-14/+13
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-1/+1
2019-12-18no need to bootstrapMark Mansi-1/+1
2019-12-18remove a bit more hackeryMark Mansi-0/+1
2019-12-18Propagate cfg bootstrapMark Rousskov-2/+0
2019-12-13Reuse the `staged_api` feature for `rustc_const_unstable`Oliver Scherer-1/+1
2019-11-06gate rustc_on_unimplemented under rustc_attrsMazdak Farrokhzad-1/+1
2019-10-22Add Cow::is_borrowed and Cow::is_ownedClar Fon-0/+1
2019-10-13Rollup merge of #65214 - Amanieu:cfg_atomic, r=alexcrichtonMazdak Farrokhzad-1/+1
Split non-CAS atomic support off into target_has_atomic_load_store This PR implements my proposed changes in https://github.com/rust-lang/rust/issues/32976#issuecomment-518542029 by removing `target_has_atomic = "cas"` and splitting `target_has_atomic` into two separate `cfg`s: * `target_has_atomic = 8/16/32/64/128`: This indicates the largest width that the target can atomically CAS (which implies support for all atomic operations). * ` target_has_atomic_load_store = 8/16/32/64/128`: This indicates the largest width that the target can support loading or storing atomically (but may not support CAS). cc #32976 r? @alexcrichton
2019-10-08Stabilize mem::take (mem_take)Jon Gjengset-1/+0
Tracking issue: https://github.com/rust-lang/rust/issues/61129
2019-10-08Split non-CAS atomic support off into target_has_atomic_load_storeAmanieu d'Antras-1/+1
2019-09-25Snap cfgs to new betaMark Rousskov-1/+0
2019-09-16Const-stabilize `Vec::new`.Mazdak Farrokhzad-1/+1
2019-09-07Improve hygiene of `alloc::format!`Vadim Petrochenkov-0/+6
2019-08-16Add the Layout of the failed allocation to TryReserveError::AllocErrorSimon Sapin-0/+1
… and add a separately-unstable field to force non-exhaustive matching (`#[non_exhaustive]` is no implemented yet on enum variants) so that we have the option to later expose the allocator’s error value. CC https://github.com/rust-lang/wg-allocators/issues/23
2019-08-14Handle cfg(bootstrap) throughoutMark Rousskov-3/+3
2019-08-08Use associated_type_bounds where applicable - closes #61738Ilija Tovilo-0/+1
2019-08-05Add implementations for converting boxed slices into boxed arraysJake Goulding-1/+1
This mirrors the implementations of reference slices into arrays.
2019-07-30Rollup merge of #63095 - Centril:incomplete-features-lint, r=varkorMazdak Farrokhzad-0/+1
Turn `INCOMPLETE_FEATURES` into lint We do this because it is annoying to see the warning when building rustc and because this is better from a "separation of concerns" POV. The drawback to this change is that this will respect `--cap-lints`. Also note that this is not a buffered lint so if there are fatal parser errors then the lint will not trigger. r? @varkor
2019-07-30Rollup merge of #62469 - czipperz:liballoc-add-doc-links, r=GuillaumeGomezMazdak Farrokhzad-13/+19
Add doc links to liballoc crate page
2019-07-30Allow 'incomplete_features' in libcore/alloc.Mazdak Farrokhzad-0/+1
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-2/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-28Use const generics for some Vec/CCow impls.Mazdak Farrokhzad-0/+2
2019-07-21use a const to hack around promotion limitationsRalf Jung-0/+1
2019-07-19use const array repeat expressions for uninit_arrayRalf Jung-0/+1
2019-07-13Auto merge of #61953 - Centril:shared-from-iter, r=RalfJungbors-0/+1
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-07Add doc links to liballoc crate pageChris Gregory-13/+19
2019-07-04Switch master to 1.38Mark Rousskov-1/+0
2019-07-01Enable mem_take feature in relevant cratesChris Gregory-0/+1
2019-06-20deduplicate slice_from_raw_parts_mut.Mazdak Farrokhzad-1/+1
2019-06-20shared_from_iter/Rc: Use specialization to elide allocation.Mazdak Farrokhzad-0/+1
2019-06-16Separate liballoc modulechansuke-1/+1
2019-06-08Turn `#[allocator]` into a built-in attribute and rename it to ↵Vadim Petrochenkov-1/+1
`#[rustc_allocator]`
2019-05-30Stabilize iter_nth_back featureLzu Tao-1/+0
2019-05-20stabilize core parts of MaybeUninit and deprecate mem::uninitialized in the ↵Ralf Jung-1/+1
future Also expand the documentation a bit
2019-05-04Remove unused feature(need_allocator).Mazdak Farrokhzad-1/+0
2019-04-23Stabilize futures_apiTaylor Cramer-1/+0
2019-04-15warn(missing_docs) in liballoc, and add missing docsRalf Jung-0/+1
2019-04-14make lint levels more consistentRalf Jung-3/+3
2019-04-14bump stdsimd; make intra_doc_link_resolution_failure an error againRalf Jung-1/+1
2019-04-14Rollup merge of #59675 - SimonSapin:stable-alloc, r=alexcrichtonMazdak Farrokhzad-4/+1
Stabilize the `alloc` crate. This implements RFC 2480: * https://github.com/rust-lang/rfcs/pull/2480 * https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md Closes https://github.com/rust-lang/rust/issues/27783
2019-04-12Stabilize the `alloc` crate.Simon Sapin-4/+1
This implements RFC 2480: * https://github.com/rust-lang/rfcs/pull/2480 * https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md Closes https://github.com/rust-lang/rust/issues/27783
2019-04-05Add Fn* blanket impls for Box.Masaki Hara-0/+1