about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2018-07-09Auto merge of #52159 - SimonSapin:alloc-prelude, r=alexcrichtonbors-1/+30
Add the `alloc::prelude` module It contains the re-exports that are in `std::prelude::v1` but not in `core::prelude::v1`. Calling it prelude is somewhat of a misnomer since (unlike those modules in `std` or `core`) its contents are never implicitly imported in modules. Rather it is intended to be used with an explicit glob import like `use alloc::prelude::*;`. However there is precedent for the same misnomer with `std::io::prelude`, for example. This new module is unstable with the same feature name as the `alloc` care. They are proposed for stabilization together in RFC https://github.com/rust-lang/rfcs/pull/2480.
2018-07-09Removed a single trailing space. Oops.Orson Peters-1/+1
2018-07-09Reimplemented Vec's swap_remove to not rely on pop.Orson Peters-4/+6
2018-07-09Performance improvement of Vec's swap_remove.Orson Peters-3/+7
2018-07-07Add the `alloc::prelude` moduleSimon Sapin-1/+30
It contains the re-exports that are in `std::prelude::v1` but not in `core::prelude::v1`. Calling it prelude is somewhat of a misnomer since (unlike those modules in `std` or `core`) its contents are never implicitly imported in modules. Rather it is intended to be used with an explicit glob import like `use alloc::prelude::*;`. However there is precedent for the same misnomer with `std::io::prelude`, for example. This new module is unstable with the same feature name as the `alloc` care. They are proposed for stabilization together in RFC https://github.com/rust-lang/rfcs/pull/2480
2018-07-06Rollup merge of #52103 - tmccombs:rc_downcast, r=Mark-SimulacrumMark Rousskov-4/+2
Stabilize rc_downcast Fixes #44608
2018-07-07Fix is_dangling import when Arc is #[cfg]’ed outSimon Sapin-7/+7
2018-07-07Add some unit tests for dangling Weak referencesSimon Sapin-0/+112
2018-07-07Rc: remove unused allocation from Weak::new()Simon Sapin-24/+37
Same as https://github.com/rust-lang/rust/pull/50357
2018-07-07Use an aligned dangling pointer in Weak::new, rather than address 1Simon Sapin-21/+29
2018-07-06Auto merge of #51953 - japaric:atomic-load-store, r=alexcrichtonbors-4/+16
enable Atomic*.{load,store} for ARMv6-M / MSP430 closes #45085 as proposed in https://github.com/rust-lang/rust/issues/45085#issuecomment-384825434 this commit adds an `atomic_cas` target option and extends the `#[cfg(target_has_atomic)]` attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS natively, like MSP430 and ARMv6-M. r? @alexcrichton
2018-07-06Stabilize rc_downcastThayne McCombs-4/+2
Fixes #44608
2018-07-05#[cfg(target_has_atomic_cas)] -> #[cfg(target_has_atomic = "cas")]Jorge Aparicio-9/+16
2018-07-05enable Atomic*.{load,store} for ARMv6-M / MSP430Jorge Aparicio-4/+9
closes #45085 this commit adds an `atomic_cas` target option and an unstable `#[cfg(target_has_atomic_cas)]` attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS natively, like MSP430 and ARMv6-M.
2018-07-03Strenghten synchronization in `Arc::is_unique`Ralf Jung-6/+7
Previously, `is_unique` would not synchronize at all with a `drop` that returned early because it was not the last reference, leading to a data race. Fixes #51780
2018-07-03Rollup merge of #51914 - ↵Pietro Albini-7/+10
nikomatsakis:nll-fix-issue-issue-btreemap-annotations, r=gankro add outlives annotations to `BTreeMap` NLL requires these annotations, I believe because of <https://github.com/rust-lang/rust/issues/29149>. Fixes #48224 r? @Gankro cc @lqd
2018-07-02Implemented `UnsafeFutureObj` on `Box`Josef Reinhard Brandl-2/+21
2018-07-02Implement `UnsafeFutureObj` for `&mut Future`Josef Reinhard Brandl-1/+3
2018-07-02add outlives annotations to `BTreeMap`Niko Matsakis-7/+10
nll requires these annotations, I believe because of https://github.com/rust-lang/rust/issues/29149
2018-07-02`UnsafeFutureObj` impl for `PinMut`Josef Reinhard Brandl-7/+6
2018-07-02Add lifetime to `FutureObj`Josef Reinhard Brandl-8/+9
2018-07-02Use `From` impls for `FutureObj<()>`Josef Reinhard Brandl-12/+12
2018-07-02Make custom trait object for `Future` genericJosef Reinhard Brandl-15/+15
2018-07-02Make `BTreeMap::clone()` not allocate when cloning an empty tree.Nicholas Nethercote-1/+10
2018-06-30Auto merge of #51717 - Mark-Simulacrum:snap, r=alexcrichtonbors-1/+0
Bootstrap from 1.28.0 beta
2018-06-30Bootstrap from 1.28.0-beta.3Mark Simulacrum-1/+0
2018-06-29liballoc docs: Remove “not intended for general usage”Simon Sapin-4/+4
2018-06-29Rename alloc::arc to alloc::sync, to match std::syncSimon Sapin-3/+3
2018-06-29Remove the Vec and String reexports at the root of the alloc crateSimon Sapin-5/+0
… since `std` has no corresponding reexports. Use `alloc::vec::Vec` and `alloc::string::String` instead.
2018-06-29Move core::alloc::CollectionAllocErr to alloc::collectionsSimon Sapin-5/+34
2018-06-29Move some alloc crate top-level items to a new alloc::collections moduleSimon Sapin-42/+65
This matches std::collections
2018-06-29Remove the unstable alloc::allocator module reexport, deprecated since 1.27Simon Sapin-7/+0
2018-06-29Make raw_vec perma-unstable and hiddenSimon Sapin-2/+5
2018-06-28Arc: remove unused allocation from Weak::new()Sean McArthur-20/+36
2018-06-27Add str::split_ascii_whitespace.Clar Charr-0/+3
2018-06-26Add `LocalTaskObj`Josef Reinhard Brandl-2/+16
2018-06-22Auto merge of #51463 - estebank:error-codes, r=nikomatsakisbors-2/+8
Various changes to existing diagnostics * [Add code to `invalid ABI` error, add span label, move list to help to make message shorter](https://github.com/rust-lang/rust/pull/51463/commits/23ae5af274defa9ff884f593e44a2bbcaf814a02): ``` error[E0697]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI | ^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted ``` * [Add code to incorrect `pub` restriction error](https://github.com/rust-lang/rust/pull/51463/commits/e96fdea8a38f39f99f8b9a4000a689187a457e08) * [Add message to `rustc_on_unimplemented` attributes in core to have them set a custom message _and_ label](https://github.com/rust-lang/rust/pull/51463/commits/2cc7e5ed307aee936c20479cfdc7409d6b52a464): ``` error[E0277]: `W` does not have a constant size known at compile-time --> $DIR/unsized-enum2.rs:33:8 | LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type ``` ``` error[E0277]: `Foo` cannot be sent between threads safely --> $DIR/E0277-2.rs:26:5 | LL | is_send::<Foo>(); | ^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `Foo` ``` ``` error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:16:7 | LL | 5 < String::new(); | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}` ``` ``` error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:17:7 | LL | 6 == Ok(1); | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}` ``` ``` error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:16:19 | LL | struct WellFormed<Z = Foo<i32, i32>>(Z); | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` note: required by `Foo` --> $DIR/type-check-defaults.rs:15:1 | LL | struct Foo<T, U: FromIterator<T>>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` * [Add link to book for `Sized` errors](https://github.com/rust-lang/rust/pull/51463/commits/1244dc7c283323aea1a3457a4458d590a3e160c8): ``` error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:13:29 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: constant expressions must have a statically known size ``` * [Point to previous line for single expected token not found](https://github.com/rust-lang/rust/pull/51463/commits/48165168fb0f059d8536cd4a2276b609d4a7f721) (if the current token is in a different line)
2018-06-19Add message to `rustc_on_unimplemented` attributes in coreEsteban Küber-2/+8
2018-06-18Rename OOM to allocation errorSimon Sapin-17/+21
The acronym is not descriptive unless one has seen it before. * Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle. * Rename `set_oom_hook` to `set_alloc_error_hook` * Rename `take_oom_hook` to `take_alloc_error_hook` Bikeshed: `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-16Auto merge of #51562 - SimonSapin:transparent, r=cramertjbors-1/+1
Stabilize #[repr(transparent)] Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-13Improve core::task::TaskObjJosef Reinhard Brandl-4/+4
2018-06-12Stabilize #[repr(transparent)]Simon Sapin-1/+1
Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-12Auto merge of #51241 - glandium:globalalloc, r=sfackler,SimonSapinbors-190/+127
Stabilize GlobalAlloc and #[global_allocator] This PR implements the changes discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-393263510 Fixes #49668 Fixes #27389 This does not change the default global allocator: #36963
2018-06-11More alloc docs tweaksSimon Sapin-2/+4
2018-06-11Stabilize alloc::oom (but not set_oom_hook or take_oom_hook)Simon Sapin-1/+1
2018-06-11Stabilize alloc free functions for the global allocators.Simon Sapin-4/+4
2018-06-11Stablize the alloc module without changing stability of its contents.Simon Sapin-6/+5
2018-06-11Document memory allocation APIsSimon Sapin-0/+65
Add some docs where they were missing, attempt to fix them where they were out of date.
2018-06-11Remove some unneeded castsSimon Sapin-3/+3
2018-06-11Remove the deprecated Heap type/constSimon Sapin-9/+0