about summary refs log tree commit diff
path: root/src/liballoc/heap.rs
AgeCommit message (Collapse)AuthorLines
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]
2014-10-25get rid of libc_heap::{malloc_raw, realloc_raw}Daniel Micay-6/+21
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-09alloc: Convert statics to constantsAlex Crichton-1/+1
2014-10-08saner parameter order for reallocation functionsDaniel Micay-19/+14
Using reallocate(old_ptr, old_size, new_size, align) makes a lot more sense than reallocate(old_ptr, new_size, align, old_size) and matches up with the order used by existing platform APIs like mremap. Closes #17837 [breaking-change]
2014-10-02Test fixes from the rollupAlex Crichton-0/+1
2014-10-02alloc: fix reallocate_inplace implementationDaniel Micay-9/+26
The returned size is the new real size of the allocation.
2014-09-30Fix liballocSteven Fackler-8/+8
2014-09-16Register new snapshotsAlex Crichton-29/+0
This is the first linux snapshot created on our new CentOS 5.10 builders. Closes #9545
2014-09-16Fallout from renamingAaron Turon-2/+2
2014-09-16auto merge of #17197 : nikomatsakis/rust/issue-5527-trait-reform-revisited, ↵bors-1/+0
r=pcwalton This patch does not make many functional changes, but does a lot of restructuring towards the goals of #5527. This is the biggest patch, basically, that should enable most of the other patches in a relatively straightforward way. Major changes: - Do not track impls through trans, instead recompute as needed. - Isolate trait matching code into its own module, carefully structure to distinguish various phases (selection vs confirmation vs fulfillment) - Consider where clauses in their more general form - Integrate checking of builtin bounds into the trait matching process, rather than doing it separately in kind.rs (important for opt-in builtin bounds) What is not included: - Where clauses are still not generalized. This should be a straightforward follow-up patch. - Caching. I did not include much caching. I have plans for various kinds of caching we can do. Should be straightforward. Preliminary perf measurements suggested that this branch keeps compilation times roughly what they are. - Method resolution. The initial algorithm I proposed for #5527 does not work as well as I hoped. I have a revised plan which is much more similar to what we do today. - Deref vs deref-mut. The initial fix I had worked great for autoderef, but not for explicit deref. - Permitting blanket impls to overlap with specific impls. Initial plan to consider all nested obligations before considering an impl to match caused many compilation errors. We have a revised plan but it is not implemented here, should be a relatively straightforward extension.
2014-09-15remove the closure_exchange_malloc lang itemDaniel Micay-17/+1
2014-09-15heap: optimize EMPTY to avoid relocationsDaniel Micay-5/+6
Sized deallocation makes it pointless to provide an address that never overlaps with pointers returned by an allocator. Code can branch on the capacity of the allocation instead of a comparison with this sentinel. This improves the situation in #8859, and the remaining issues are only from the logging API, which should be disabled by default in optimized release builds anyway along with debug assertions. The remaining issues are part of #17081. Closes #8859
2014-09-15heap: rm out-of-date FIXMEsDaniel Micay-2/+0