about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2014-12-26Implement Sync/Send for ArcInner and WeakFlavio Percoco-3/+10
2014-12-26Relax `Arc` bounds don't require Sync+SendFlavio Percoco-1/+1
Besides the above making sense, it'll also allow us to make `RacyCell` private and use UnsafeCell instead.
2014-12-26Rename `UniquePtr` to `Unique`Flavio Percoco-2/+2
Mostly following the convention in RFC 356
2014-12-26Make Send and Sync traits unsafeFlavio Percoco-2/+2
2014-12-26Rename `OwnedPtr` to `UniquePtr`Flavio Percoco-2/+2
2014-12-26Require types to opt-in SyncFlavio Percoco-1/+6
2014-12-21Test fixes and rebase conflictsAlex Crichton-7/+8
2014-12-21rollup merge of #20070: aturon/stab-2-cloneAlex Crichton-3/+3
This patch marks `clone` stable, as well as the `Clone` trait, but leaves `clone_from` unstable. The latter will be decided by the beta. The patch also marks most manual implementations of `Clone` as stable, except where the APIs are otherwise deprecated or where there is uncertainty about providing `Clone`. r? @alexcrichton
2014-12-21rollup merge of #20052: barosl/deref-for-boxAlex Crichton-0/+15
As the previous pull request (#19023) was closed due to inactivity, I steal the chance and open this pull request. :blush: Fixes #18624.
2014-12-21rollup merge of #19944: steveklabnik/doc_sync_arcAlex Crichton-88/+329
Take the docs from Rc<T>, apply them to Arc<T>, and fix some line lengths.
2014-12-20Stabilize cloneAaron Turon-3/+3
This patch marks `clone` stable, as well as the `Clone` trait, but leaves `clone_from` unstable. The latter will be decided by the beta. The patch also marks most manual implementations of `Clone` as stable, except where the APIs are otherwise deprecated or where there is uncertainty about providing `Clone`.
2014-12-20Implement Deref for BoxBarosl Lee-0/+15
Fixes #18624.
2014-12-18Revise std::thread API to join by defaultAaron Turon-2/+3
This commit is part of a series that introduces a `std::thread` API to replace `std::task`. In the new API, `spawn` returns a `JoinGuard`, which by default will join the spawned thread when dropped. It can also be used to join explicitly at any time, returning the thread's result. Alternatively, the spawned thread can be explicitly detached (so no join takes place). As part of this change, Rust processes now terminate when the main thread exits, even if other detached threads are still running, moving Rust closer to standard threading models. This new behavior may break code that was relying on the previously implicit join-all. In addition to the above, the new thread API also offers some built-in support for building blocking abstractions in user space; see the module doc for details. Closes #18000 [breaking-change]
2014-12-17rollup merge of #19947: csouth3/arc-borrowfromAlex Crichton-0/+7
Closes #19937.
2014-12-17rollup merge of #19902: alexcrichton/second-pass-memAlex Crichton-0/+7
This commit stabilizes the `mem` and `default` modules of std.
2014-12-16Implement BorrowFrom<Arc<T>> for TChase Southwood-0/+7
2014-12-16Improve Arc<T> documentation, and Rc<T> docs a bitSteve Klabnik-88/+329
Take the docs from Rc<T>, apply them to Arc<T>, and fix some line lengths.
2014-12-15Move hash module from collections to coreSteven Fackler-1/+19
2014-12-15std: Second pass stabilization of `default`Alex Crichton-0/+7
This commit performs a second pass stabilization of the `std::default` module. The module was already marked `#[stable]`, and the inheritance of `#[stable]` was removed since this attribute was applied. This commit adds the `#[stable]` attribute to the trait definition and one method name, along with all implementations found in the standard distribution.
2014-12-14Mostly rote conversion of `proc()` to `move||` (and occasionally `Thunk::new`)Niko Matsakis-2/+2
2014-12-08Implemented BorrowFrom<Rc<T>> for T.Aaron Weiss-0/+7
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-5/+5
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-06liballoc: remove unnecessary `as_slice()` callsJorge Aparicio-5/+5
2014-12-05Utilize fewer reexportsCorey Farwell-8/+15
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-04Add ability to use custom alloc::heap::impAlexander Light-3/+55
Adds the ability to use a custom allocator heap by passing either --cfg external_crate and --extern external=<allocator_crate_name> or --cfg external_funcs and defining the allocator functions prefixed by 'rust_' somewhere. This is useful for many reasons including OS/embedded development, and allocator development and testing.
2014-11-27auto merge of #19112 : steveklabnik/rust/doc_rc, r=Gankrobors-57/+296
2014-11-26Remove special casing for some meta attributesSteven Fackler-1/+0
Descriptions and licenses are handled by Cargo now, so there's no reason to keep these attributes around.
2014-11-25Document liballoc::rcSteve Klabnik-57/+296
This commit introduces a bunch of documentation, fixes some consistency issues, and just basically brings Rc<T> and Weak<T> up to snuff.
2014-11-23rollup merge of #19225: reem/any-unnecessary-transmute-copyJakub Bukaj-7/+3
transmute_copy is no longer needed and is just slow.
2014-11-23rollup merge of #19193: scialex/rc-countsJakub Bukaj-4/+100
These functions allow you to see how many weak and strong references there are to an `Arc`, `Rc`, or an `rc::Weak`. Due to the design of `Arc` it is not possible to get the number of weak references of an arbitrary `arc::Weak`. Look in `arc.rs` for a more in-depth explanation. On `arc::Arc` and `arc::Weak` these operations are wait-free and atomic. This sort of information is useful for creating dynamically cleared caches for use in OS development, for example holding pages of files in memory until the address space is needed for something else.
2014-11-22Any: use plain transmute instead of transmute_copy for downcasting.Jonathan Reem-7/+3
transmute_copy is no longer needed and is just slow.
2014-11-21Shuffle locations for DerefAlexander Light-92/+57
Remove both `strong_count` and `weak_count` from `Weak`s and make the methods bare functions so as not to cause trouble with `deref`.
2014-11-21Add `weak_count` and `strong_count` to Rc and ArcAlexander Light-2/+133
These functions allow you to see how many weak and strong references there are to an `Arc`, `Rc`, or an `rc::Weak`. Due to the design of `Arc` it is not possible to get the number of weak references of an arbitrary `arc::Weak`. Look in `arc.rs` for a more in-depth explanation. On `arc::Arc` and `arc::Weak` these operations are wait-free and atomic.
2014-11-20Fallout from libgreen and libnative removalAaron Turon-1/+0
2014-11-14libs: fix #[stable] inheritance falloutAaron Turon-3/+1
A recent change turned off inheritance for the #[stable] by default, but failed to catch all the cases where this was being used in std. This patch fixes that problem.
2014-11-12Register new snapshotsAlex Crichton-40/+0
2014-11-07auto merge of #18714 : nikomatsakis/rust/issue-18621-deref-for-refs, r=aturonbors-1/+1
libs: add Deref, DerefMut impls for references, fixing a bug in compiler in the process that was blocking this. r? @aturon
2014-11-06libs: add Deref, DerefMut impls for references, fixing a bug in compiler in ↵Niko Matsakis-1/+1
the process that was blocking this. Fixes #18621.
2014-11-06Implement Default for Box<[T]>Jorge Aparicio-0/+4
2014-11-05DSTify Box<T> implementation of PartialEq, PartialOrd, Eq, OrdJorge Aparicio-0/+40
2014-11-01bubble up out-of-memory errors from liballocDaniel Micay-60/+33
This makes the low-level allocation API suitable for use cases where out-of-memory conditions need to be handled. Closes #18292 [breaking-change]
2014-10-30DSTify Show and all the other formatting traitsJorge Aparicio-1/+2
2014-10-29Rename fail! to panic!Steve Klabnik-5/+5
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-27alloc: Make deriving more friendly with ArcAlex Crichton-19/+53
This adds impls of Eq/Ord/PartialEq/PartialOrd/Show/Default to Arc<T>, and it also removes the `Send + Sync` bound on the `Clone` impl of Arc to make it more deriving-friendly. The `Send + Sync` requirement is still enforce on construction, of course!
2014-10-26Implement Show for `Arc<T>`Adolfo Ochagavía-0/+14
Fixes https://github.com/rust-lang/rust/issues/18299
2014-10-25fix sized deallocation documentationDaniel Micay-13/+13
2014-10-25return the new usable size from reallocate_inplaceDaniel Micay-19/+13
The real size is also more useful than just a boolean, and the caller can easily determine if the operation failed from the real size. In most cases, the caller is only going to be growing the allocation so a branch can be avoided. [breaking-change]
2014-10-25get rid of libc_heap::{malloc_raw, realloc_raw}Daniel Micay-60/+23
The C standard library functions should be used directly. The quirky NULL / zero-size allocation workaround is no longer necessary and was adding an extra branch to the allocator code path in a build without jemalloc. This is a small step towards liballoc being compatible with handling OOM errors instead of aborting (#18292). [breaking-change]
2014-10-25Make MIN_ALIGN a const to allow better optimizationBjörn Steinbrink-2/+2
With MIN_ALIGN as a static, other crates don't have access to its value at compile time, because it is an extern global. That means that the checks against it can't be optimized out, which is rather unfortunate. So let's make it a constant instead.
2014-10-16liballoc: Remove all uses of {:?}.Luqman Aden-2/+0