about summary refs log tree commit diff
path: root/src/liballoc/heap.rs
AgeCommit message (Collapse)AuthorLines
2016-05-28rustfmt liballoc folderSrinivas Reddy Thatiparthy-1/+1
2016-02-04Synthesize calls to box_free language itemSimonas Kazlauskas-0/+13
This gets rid of Drop(Free, _) MIR construct by synthesizing a call to language item which takes care of dropping instead.
2015-11-24rustfmt: liballoc, liballoc_*, libarenaNick Cameron-1/+1
2015-09-24Better function callsNick Cameron-2/+6
2015-09-24rustfmt liballocNick Cameron-8/+17
2015-08-15alloc: Add issues for all unstable featuresAlex Crichton-1/+2
2015-08-14rustc: Allow changing the default allocatorAlex Crichton-371/+19
This commit is an implementation of [RFC 1183][rfc] which allows swapping out the default allocator on nightly Rust. No new stable surface area should be added as a part of this commit. [rfc]: https://github.com/rust-lang/rfcs/pull/1183 Two new attributes have been added to the compiler: * `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to indicate that it requires an allocator crate to be in scope. * `#![allocator]` - this is a indicator that the crate is an allocator which can satisfy the `needs_allocator` attribute above. The ABI of the allocator crate is defined to be a set of symbols that implement the standard Rust allocation/deallocation functions. The symbols are not currently checked for exhaustiveness or typechecked. There are also a number of restrictions on these crates: * An allocator crate cannot transitively depend on a crate that is flagged as needing an allocator (e.g. allocator crates can't depend on liballoc). * There can only be one explicitly linked allocator in a final image. * If no allocator is explicitly requested one will be injected on behalf of the compiler. Binaries and Rust dylibs will use jemalloc by default where available and staticlibs/other dylibs will use the system allocator by default. Two allocators are provided by the distribution by default, `alloc_system` and `alloc_jemalloc` which operate as advertised. Closes #27389
2015-06-17alloc: Split apart the global `alloc` featureAlex Crichton-1/+6
2015-06-13Switch to direct HeapAlloc on Windows when not using jemallocPeter Atashian-17/+102
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-05-11Rollup merge of #25254 - cgaebel:check-sizes-on-allocate, r=GankroSteve Klabnik-0/+12
They're only enabled in debug builds, but a panic is usually more welcome than UB in debug builds. Previous review at https://github.com/rust-lang/rust/pull/22069 r? @Gankro cc @huon
2015-05-09[liballoc] Adds checks for UB during allocation.Clark Gaebel-0/+12
They're only enabled in debug builds, but a panic is usually more welcome than UB in debug builds.
2015-05-09Convert #[lang="..."] to #[lang = "..."]Nick Hamann-2/+2
In my opinion this looks nicer, but also it matches the whitespace generally used for stability markers more closely.
2015-04-27std: Prepare for linking to muslAlex Crichton-1/+3
This commit modifies the standard library and its dependencies to link correctly when built against MUSL. This primarily ensures that the right libraries are linked against and when they're linked against they're linked against statically.
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-1/+1
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.
2015-04-16Suppress improper_ctypes warnings when compiling liballoc with external_featuresKrzysztof Drewniak-0/+1
2015-03-31Auto merge of #23549 - aturon:stab-num, r=alexcrichtonbors-1/+0
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change] r? @alexcrichton
2015-03-31Stabilize std::numAaron Turon-1/+0
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-30std: Standardize (input, output) param orderingsAlex Crichton-1/+1
This functions swaps the order of arguments to a few functions that previously took (output, input) parameters, but now take (input, output) parameters (in that order). The affected functions are: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-23Add note about pointer state after the call.Steve Klabnik-0/+3
Fixes #23422
2015-03-18Register new snapshotsAlex Crichton-4/+0
2015-03-16remove importsJorge Aparicio-1/+0
2015-03-16impl<T> *const T, impl<T> *mut TJorge Aparicio-0/+1
2015-03-13Add an "allocator" attribute to mark functions as allocatorsBjörn Steinbrink-0/+1
When this attribute is applied to a function, its return value gets the noalias attribute, which is how you tell LLVM that the function returns a "new" pointer that doesn't alias anything accessible to the caller, i.e. it acts like a memory allocator. Plain malloc doesn't need this attribute because LLVM already knows about malloc and adds the attribute itself.
2015-03-03Add `: Box<_>` or `::Box<_>` type annotations to various places.Felix S. Klock II-1/+2
This is the kind of change that one is expected to need to make to accommodate overloaded-`box`. ---- Note that this is not *all* of the changes necessary to accommodate Issue 22181. It is merely the subset of those cases where there was already a let-binding in place that made it easy to add the necesasry type ascription. (For unnamed intermediate `Box` values, one must go down a different route; `Box::new` is the option that maximizes portability, but has potential inefficiency depending on whether the call is inlined.) ---- There is one place worth note, `run-pass/coerce-match.rs`, where I used an ugly form of `Box<_>` type ascription where I would have preferred to use `Box::new` to accommodate overloaded-`box`. I deliberately did not use `Box::new` here, because that is already done in coerce-match-calls.rs. ---- Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-02-26Fixed build with jemalloc disabledValerii Hiora-1/+1
2015-02-09int/uint => isize/usize in liblibc/liballoc/libarenawe-43/+44
2015-01-30Remove all `i` suffixesTobias Bucher-1/+1
2015-01-29Rollup merge of 21681 - japaric:no-warn, r=alexcrichtonManish Goregaokar-0/+1
2015-01-27fix #[cfg(test)] warningsJorge Aparicio-0/+1
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-1/+1
Conflicts: mk/tests.mk src/liballoc/arc.rs src/liballoc/boxed.rs src/liballoc/rc.rs src/libcollections/bit.rs src/libcollections/btree/map.rs src/libcollections/btree/set.rs src/libcollections/dlist.rs src/libcollections/ring_buf.rs src/libcollections/slice.rs src/libcollections/str.rs src/libcollections/string.rs src/libcollections/vec.rs src/libcollections/vec_map.rs src/libcore/any.rs src/libcore/array.rs src/libcore/borrow.rs src/libcore/error.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/ops.rs src/libcore/result.rs src/libcore/slice.rs src/libcore/str/mod.rs src/libregex/lib.rs src/libregex/re.rs src/librustc/lint/builtin.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/mutex.rs src/libstd/sync/poison.rs src/libstd/sync/rwlock.rs src/libsyntax/feature_gate.rs src/libsyntax/test.rs
2015-01-23Set unstable feature names appropriatelyBrian Anderson-1/+1
* `core` - for the core crate * `hash` - hashing * `io` - io * `path` - path * `alloc` - alloc crate * `rand` - rand crate * `collections` - collections crate * `std_misc` - other parts of std * `test` - test crate * `rustc_private` - everything else
2015-01-21Remove 'since' from unstable attributesBrian Anderson-1/+1
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-1/+1
2015-01-21Test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-21rollup merge of #21444: petrochenkov/nullAlex Crichton-1/+1
Conflicts: src/libstd/sync/mpsc/select.rs
2015-01-19Replace `0 as *const/mut T` with `ptr::null/null_mut()`we-1/+1
2015-01-17Remove unnecessary explicit conversions to *const Twe-1/+1
2015-01-11powerpc: Tell liballoc about power alignmentRicho Healey-1/+2
2015-01-07Test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-07Fix warning in liballoc about unused constant MIN_ALIGN when cfg(feature = ↵John Ericson-6/+10
external_*)
2015-01-07liballoc's "extern_funcs" impl mod had a duplicate and missing itemJohn Ericson-5/+4
2015-01-07Shorten cfg line lengths in liballocJohn Ericson-3/+11
2015-01-07liballoc's "external_funcs" and "external_crate" are now featuresJohn Ericson-5/+5
This allows the vanilla libary to built for kernel use with Cargo.
2015-01-03Initial version of AArch64 support.Akos Kiss-2/+3
Adds AArch64 knowledge to: * configure, * make files, * sources, * tests, and * documentation.
2014-12-29std: Second pass stabilization for `ptr`Alex Crichton-2/+2
This commit performs a second pass for stabilization over the `std::ptr` module. The specific actions taken were: * The `RawPtr` trait was renamed to `PtrExt` * The `RawMutPtr` trait was renamed to `MutPtrExt` * The module name `ptr` is now stable. * These functions were all marked `#[stable]` with no modification: * `null` * `null_mut` * `swap` * `replace` * `read` * `write` * `PtrExt::is_null` * `PtrExt::offset` * These functions remain unstable: * `as_ref`, `as_mut` - the return value of an `Option` is not fully expressive as null isn't the only bad value, and it's unclear whether we want to commit to these functions at this time. The reference/lifetime semantics as written are also problematic in how they encourage arbitrary lifetimes. * `zero_memory` - This function is currently not used at all in the distribution, and in general it plays a broader role in the "working with unsafe pointers" story. This story is not yet fully developed, so at this time the function remains unstable for now. * `read_and_zero` - This function remains unstable for largely the same reasons as `zero_memory`. * These functions are now all deprecated: * `PtrExt::null` - call `ptr::null` or `ptr::null_mut` instead. * `PtrExt::to_uint` - use an `as` expression instead. * `PtrExt::is_not_null` - use `!p.is_null()` instead.
2014-12-05Utilize fewer reexportsCorey Farwell-1/+2
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-01bubble up out-of-memory errors from liballocDaniel Micay-56/+28
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-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]