summary refs log tree commit diff
path: root/src/liballoc/lib.rs
AgeCommit message (Collapse)AuthorLines
2018-01-20Assign its own tracking issue to Box::into_raw_non_nullSimon Sapin-0/+1
https://github.com/rust-lang/rust/issues/47336
2018-01-20Stabilize std::ptr::NonNullSimon Sapin-1/+0
2018-01-20Mark Unique as perma-unstable, with the feature renamed to ptr_internals.Simon Sapin-1/+1
2018-01-20Rename std::ptr::Shared to NonNullSimon Sapin-1/+1
`Shared` is now a deprecated `type` alias. CC https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629
2018-01-15Reexport -> re-export in prose and documentation commentsCarol (Nichols || Goulding)-2/+2
2018-01-13Add slice::ExactChunks and ::ExactChunksMut iteratorsSebastian Dröge-0/+1
These guarantee that always the requested slice size will be returned and any leftoever elements at the end will be ignored. It allows llvm to get rid of bounds checks in the code using the iterator. This is inspired by the same iterators provided by ndarray. See https://github.com/rust-lang/rust/issues/47115
2017-11-08std: Remove `rand` crate and moduleAlex Crichton-0/+2
This commit removes the `rand` crate from the standard library facade as well as the `__rand` module in the standard library. Neither of these were used in any meaningful way in the standard library itself. The only need for randomness in libstd is to initialize the thread-local keys of a `HashMap`, and that unconditionally used `OsRng` defined in the standard library anyway. The cruft of the `rand` crate and the extra `rand` support in the standard library makes libstd slightly more difficult to port to new platforms, namely WebAssembly which doesn't have any randomness at all (without interfacing with JS). The purpose of this commit is to clarify and streamline randomness in libstd, focusing on how it's only required in one location, hashmap seeds. Note that the `rand` crate out of tree has almost always been a drop-in replacement for the `rand` crate in-tree, so any usage (accidental or purposeful) of the crate in-tree should switch to the `rand` crate on crates.io. This then also has the further benefit of avoiding duplication (mostly) between the two crates!
2017-11-03Mark several ascii methods as unstable againLukas Kalbertodt-0/+1
We don't want to stabilize them now already. The goal of this set of commits is just to add inherent methods to the four types. Stabilizing all of those methods can be done later.
2017-11-01De-stabilize core::slice::{from_ref, from_ref_mut}.whitequark-0/+1
2017-10-09usize index message for vecGuillaume Gomez-0/+1
2017-09-21Auto merge of #44682 - bluss:iter-rfold, r=dtolnaybors-0/+1
Add iterator method .rfold(init, function); the reverse of fold rfold is the reverse version of fold. Fold allows iterators to implement a different (non-resumable) internal iteration when it is more efficient than the external iteration implemented through the next method. (Common examples are VecDeque and .chain()). Introduce rfold() so that the same customization is available for reverse iteration. This is achieved by both adding the method, and by having the Rev\<I> adaptor connect Rev::rfold → I::fold and Rev::fold → I::rfold. On the surface, rfold(..) is just .rev().fold(..), but the special case implementations allow a data structure specific fold to be used through for example .iter().rev(); we thus have gains even for users never calling exactly rfold themselves.
2017-09-18alloc: Implement rfold for VecDeque iteratorsUlrik Sverdrup-0/+1
2017-09-12impl Hasher for {&mut Hasher, Box<Hasher>}kennytm-1/+1
2017-08-29Auto merge of #44049 - alexcrichton:nounwind-allocators, r=BurntSushibors-0/+1
std: Mark allocation functions as nounwind This commit flags all allocation-related functions in liballoc as "this can't unwind" which should largely resolve the size-related issues found on #42808. The documentation on the trait was updated with such a restriction (they can't panic) as well as some other words about the relative instability about implementing a bullet-proof allocator. Closes #42808
2017-08-28std: Mark allocation functions as nounwindAlex Crichton-0/+1
This commit flags all allocation-related functions in liballoc as "this can't unwind" which should largely resolve the size-related issues found on #42808. The documentation on the trait was updated with such a restriction (they can't panic) as well as some other words about the relative instability about implementing a bullet-proof allocator. Closes #42808
2017-08-28Merge branch 'master' of https://github.com/rust-lang/rust into genJohn Kåre Alsaker-2/+0
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-2/+0
Fixes #41701.
2017-08-25Merge remote-tracking branch 'origin/master' into genAlex Crichton-1/+1
2017-08-21Add [T]::swap_with_sliceScott McMurray-1/+1
The safe version of a method from ptr, like [T]::copy_from_slice
2017-07-28Fix testsAlex Crichton-1/+1
2017-07-28std: Add forwarding impls of `Generator` traitAlex Crichton-0/+1
2017-07-26Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturonbors-4/+0
Stabilize more APIs for the 1.20.0 release In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
2017-07-25std: Stabilize the `str_{mut,box}_extras` featureAlex Crichton-1/+0
Stabilizes * `<&mut str>::as_bytes_mut` * `<Box<str>>::into_boxed_bytes` * `std::str::from_boxed_utf8_unchecked` * `std::str::from_utf8_mut` * `std::str::from_utf8_unchecked_mut` Closes #41119
2017-07-25std: Stabilize `manually_drop` featureAlex Crichton-1/+0
Stabilizes * `core::mem::ManuallyDrop` * `std::mem::ManuallyDrop` * `ManuallyDrop::new` * `ManuallyDrop::into_inner` * `ManuallyDrop::drop` * `Deref for ManuallyDrop` * `DerefMut for ManuallyDrop` Closes #40673
2017-07-25std: Stabilize `str_checked_slicing` featureAlex Crichton-1/+0
Stabilized * `<str>::get` * `<str>::get_mut` * `<str>::get_unchecked` * `<str>::get_unchecked_mut` Closes #39932
2017-07-25std: Stabilize `char_escape_debug`Alex Crichton-1/+0
Stabilizes: * `<char>::escape_debug` * `std::char::EscapeDebug` Closes #35068
2017-07-25Bump master to 1.21.0Alex Crichton-2/+1
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-16Fix checking for missing stability annotationsVadim Petrochenkov-2/+2
Remove couple of unnecessary `#![feature(staged_api)]`.
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-4/+2
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-07-02Auto merge of #43010 - stjepang:stabilize-sort-unstable, r=alexcrichtonbors-1/+0
Stabilize feature sort_unstable Closes #40585
2017-07-02Fix lint errorsStjepan Glavina-1/+0
2017-06-30Revert "Stabilize RangeArgument"Steven Fackler-1/+50
This reverts commit 143206d54d7558c2326212df99efc98110904fdb.
2017-06-24Stabilize RangeArgumentSteven Fackler-50/+1
Move it and Bound to core::ops while we're at it. Closes #30877
2017-06-15Add API for `Alloc` trait.Felix S. Klock II-0/+4
Includes `alloc_zeroed` method that `RawVec` has come to depend on. Exposed private `Layout::from_size_align` ctor to be `pub`, and added explicit conditions for when it will panic (namely, when `align` is not power-of-two, or if rounding up `size` to a multiple of `align` overflows). Normalized all `Layout` construction to go through `Layout::from_size_align`. Addressed review feedback regarding `struct Layout` and zero-sized layouts. Restrict specification for `dealloc`, adding additional constraint that the given alignment has to match that used to allocate the block. (This is a maximally conservative constraint on the alignment. An open question to resolve (before stabilization) is whether we can return to a looser constraint such as the one previously specified.) Split `fn realloc_in_place` into separate `fn grow_in_place` and `fn shrink_in_place` methods, which have default impls that check against usable_size for reuse. Make `realloc` default impl try `grow_in_place` or `shrink_in_place` as appropriate before fallback on alloc+copy+dealloc. Drive-by: When reviewing calls to `padding_needed_for`, discovered what I think was an over-conservative choice for its argument alignment. Namely, in `fn extend`, we automatically realign the whole resulting layout to satisfy both old (self) and new alignments. When the old alignment exceeds the new, this means we would insert unnecessary padding. So I changed the code to pass in `next.align` instead of `new_align` to `padding_needed_for`. Replaced ref to `realloc_in_place` with `grow_in_place`/`shrink_in_place`. Revised docs replacing my idiosyncratic style of `fn foo` with just `foo` when referring to the function or method `foo`. (Alpha-renamed `Allocator` to `Alloc`.) Post-rebased, added `Debug` derive for `allocator::Excess` to satisfy `missing_debug_implementations`.
2017-06-13Merge crate `collections` into `alloc`Murarth-10/+150
2017-04-29Update stage0 bootstrap compilerAlex Crichton-1/+0
We've got a freshly minted beta compiler, let's update to use that on nightly! This has a few other changes associated with it as well * A bump to the rustc version number (to 1.19.0) * Movement of the `cargo` and `rls` submodules to their "proper" location in `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude` option this can work. * Updates of the `cargo` and `rls` submodules to their master branches. * Tweak to the `src/stage0.txt` format to be more amenable for Cargo version numbers. On the beta channel Cargo will bootstrap from a different version than rustc (e.g. the version numbers are different), so we need different configuration for this. * Addition of `dev` as a readable key in the `src/stage0.txt` format. If present then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead of `static.rust-lang.org`. This is added to accomodate our updated release process with Travis and AppVeyor.
2017-04-26Auto merge of #41258 - clarcharr:str_box_extras, r=Kimundibors-0/+2
More methods for str boxes. (reduce Box<[u8]> ↔ Box<str> transmutes) This is a follow-up to #41096 that adds safer methods for converting between `Box<str>` and `Box<[u8]>`. They're gated under a different feature from the `&mut str` methods because they may be too niche to include in public APIs, although having them internally helps reduce the number of transmutes the standard library uses. What's added: * `From<Box<str>> for Box<[u8]>` * `<Box<str>>::into_boxed_bytes` (just calls `Into::into`) * `alloc::str` (new module) * `from_boxed_utf8` and `from_boxed_utf8_unchecked`, defined in `alloc:str`, exported in `collections::str` * exports `from_utf8_mut` in `collections::str` (missed from previous PR)
2017-04-24More methods for str boxes.Clar Charr-0/+2
2017-04-22cache attributes of items from foreign cratesAriel Ben-Yehuda-0/+1
this avoids parsing item attributes on each call to `item_attrs`, which takes off 33% (!) of translation time and 50% (!) of trans-item collection time.
2017-01-28Fix typo in liballoc/lib.rsDenis Andrejew-1/+1
2017-01-10Rollup merge of #38664 - apasel422:may-dangle, r=pnkfelixSeo Sanghyeon-1/+2
Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]` CC #34761 r? @pnkfelix
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2016-12-28Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]`Andrew Paseltiner-1/+2
CC #34761
2016-12-09Auto merge of #37492 - japaric:no-atomics-alloc, r=brsonbors-0/+2
make `alloc` and `collections` compilable for thumbv6m-none-eabi by cfging away `alloc::Arc` and changing OOM to abort for this target r? @alexcrichton cc @thejpster
2016-12-04alloc: Forward ExactSizeIterator methods in Iterator for Box<I>Ulrik Sverdrup-0/+1
2016-11-05Add `{into,from}_raw` to Rc and ArcCristi Cobzarenco-0/+4
2016-10-30make `alloc` and `collections` compilable for thumbv6m-none-eabiJorge Aparicio-0/+2
by cfging away `alloc::Arc` and changing OOM to abort for this target
2016-09-28Remove stage0 hacksBrian Anderson-1/+0
2016-08-26Replace unnecessary uses of `TraitObject` with castsAndrew Paseltiner-1/+1
2016-08-24Remove drop flags from structs and enums implementing Drop.Eduard Burtescu-1/+1