about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2016-01-16std: Stabilize APIs for the 1.7 releaseAlex Crichton-3/+1
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_neg` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2016-01-14Rollup merge of #30912 - tshepang:remove-distraction, r=steveklabnikSteve Klabnik-1/+1
2016-01-14Rollup merge of #30910 - tshepang:improve-description, r=steveklabnikSteve Klabnik-1/+1
2016-01-14doc: that suffix serves as mere distractionTshepang Lekhonkhobe-1/+1
2016-01-14doc: "x" is used as variable name on this API, so avoid using it hereTshepang Lekhonkhobe-1/+1
2016-01-14doc: "moves" has a specific meaning in Rust, so avoid using it hereTshepang Lekhonkhobe-1/+1
2016-01-14Rollup merge of #30892 - shepmaster:box-grammar, r=alexcrichtonManish Goregaokar-14/+14
2016-01-14Rollup merge of #30801 - Amanieu:oom_print, r=alexcrichtonManish Goregaokar-11/+45
This adds the ability to override the default OOM behavior by setting a handler function. This is used by libstd to print a message when running out of memory instead of crashing with an obscure "illegal hardware instruction" error (at least on Linux). Fixes #14674
2016-01-13Improve grammar of Box::{into,from}_raw docsJake Goulding-14/+14
2016-01-13Issue #30592: Restore build in --disable-jemalloc mode.Simon Martin-0/+7
2016-01-12Add set_oom_handler and use it print a message when out of memoryAmanieu d'Antras-11/+45
2016-01-05Implement in-place growth for RawVecPiotr Czarnecki-11/+107
2015-12-31Auto merge of #30593 - steveklabnik:small_rc_refactoring, r=Gankrobors-8/+11
This hairy conditional doesn't need to be so. It _does_ need to be a thin pointer, otherwise, it will fail to compile, so let's pull that out into a temporary for future readers of the source. /cc @nrc @SimonSapin @Gankro @durka , who brought this up on IRC
2015-12-30Auto merge of #30467 - shahn:master, r=brsonbors-1/+74
This adds a constructor for a Weak that can never be upgraded. These are mostly useless, but for example are required when deserializing.
2015-12-30Small refactoring to make this code more clearSteve Klabnik-8/+11
This hairy conditional doesn't need to be so. It _does_ need to be a thin pointer, otherwise, it will fail to compile, so let's pull that out into a temporary for future readers of the source. Also, after a discussion with @pnkfelix and @gankro, we don't need these null checks anymore, as zero-on-drop has been gone for a while now.
2015-12-21Register new snapshotsAlex Crichton-29/+2
Lots of cruft to remove!
2015-12-19Have to use Weak instead of Arc in Weak::new() exampleSebastian Hahn-1/+1
2015-12-19Address review commentsSebastian Hahn-6/+4
2015-12-19Implement arc::Weak::new()Sebastian Hahn-0/+37
2015-12-19Rename Weak::new_downgraded to Weak::newSebastian Hahn-4/+4
2015-12-19use core::mem::unintialized instead of uninit intrinsicSebastian Hahn-3/+3
2015-12-19Fix doctest failureSebastian Hahn-1/+3
2015-12-18Implement Weak::new_downgraded() (#30425)Sebastian Hahn-1/+37
This adds a constructor for a Weak that can never be upgraded. These are mostly useless, but for example are required when deserializing.
2015-12-10Auto merge of #30182 - alexcrichton:remove-deprecated, r=aturonbors-15/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-10std: Remove deprecated functionality from 1.5Alex Crichton-15/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-09fixed a typo in commentsTianyi Wang-1/+1
srong -> strong in liballoc/arc.rs
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-7/+3
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * The `#![no_std]` attribute * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
2015-11-26Auto merge of #30015 - petrochenkov:staged, r=brsonbors-1/+1
Closes https://github.com/rust-lang/rust/issues/30008 `#[stable]`, `#[unstable]` and `#[rustc_deprecated]` are now guarded by `#[feature(staged_api)]` r? @brson
2015-11-25Auto merge of #30017 - nrc:fmt, r=brsonbors-39/+37
2015-11-25Remove all uses of `#[staged_api]`Vadim Petrochenkov-1/+1
2015-11-24Add overflow check to `arc::Weak::upgrade`Andrew Paseltiner-0/+5
Closes #30031.
2015-11-24rustfmt: liballoc, liballoc_*, libarenaNick Cameron-39/+37
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-2/+4
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+36
2015-11-16Auto merge of #29580 - alexbool:smart-pointer-conversion, r=alexcrichtonbors-0/+40
Sometimes when writing generic code you want to abstract over owning/pointer type so that calling code isn't restricted by one concrete owning/pointer type. This commit makes possible such code: ```rust fn i_will_work_with_arc<T: Into<Arc<MyTy>>>(t: T) { let the_arc = t.into(); // Do something } i_will_work_with_arc(MyTy::new()); i_will_work_with_arc(Box::new(MyTy::new())); let arc_that_i_already_have = Arc::new(MyTy::new()); i_will_work_with_arc(arc_that_i_already_have); ``` Please note that this patch doesn't work with DSTs. Also to mention, I made those impls stable, and I don't know whether they should be actually stable from the beginning. Please tell me if this should be feature-gated.
2015-11-16Fix feature nameAlexander Bulaev-3/+3
2015-11-12Auto merge of #29544 - Ryman:reduce_doc_warnings, r=steveklabnikbors-1/+1
Did this alphabetically, so I didn't see [how `std` was doing things](https://dxr.mozilla.org/rust/source/src/libstd/lib.rs#215) till I was nearly finished. If you prefer to add crate-level-whitelists like std instead of test-level, I can rebase with that strategy. A number of these commits can probably be dropped as the crates don't have much to test, and are deprecated. Let me know which if any to drop! (can also squash after review if desired) r? @steveklabnik
2015-11-12Remove impls for cases considered `niche`Alexander Bulaev-29/+0
2015-11-12liballoc: deny warnings in doctestsKevin Butler-1/+1
2015-11-11Fix import warnings for stage0Steve Klabnik-3/+10
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-4/+0
Remove `stable` stability annotations from inherent impls
2015-11-04liballoc: implement From for Box, Rc, ArcAlexander Bulaev-0/+69
Sometimes when writing generic code you want to abstract over owning/pointer type so that calling code isn't restricted by one concrete owning/pointer type. This commit makes possible such code: ``` fn i_will_work_with_arc<T: Into<Arc<MyTy>>>(t: T) { let the_arc = t.into(); // Do something } i_will_work_with_arc(MyTy::new()); i_will_work_with_arc(Box::new(MyTy::new())); let arc_that_i_already_have = Arc::new(MyTy::new()); i_will_work_with_arc(arc_that_i_already_have); ``` Please note that this patch doesn't work with DSTs.
2015-11-02remove #![feature(rc_unique)] from Rc docsAlex Burka-3/+0
`Rc::try_unwrap` and `Rc::make_mut` are stable since 1.4.0, but the example code still has `#![feature(rc_unique)]`. Ideally the stable and beta docs would be updated, but I don't think that's possible...
2015-10-30Auto merge of #29454 - stepancheg:vec-reserve, r=blussbors-3/+49
Before this patch `reserve` function allocated twice as requested amount elements (not twice as capacity). It leaded to unnecessary excessive memory usage in scenarios like this: ``` let mut v = Vec::new(); v.push(17); v.extend(0..10); println!("{}", v.capacity()); ``` `Vec` allocated 22 elements, while it could allocate just 11. `reserve` function must have a property of keeping `push` operation cost (which calls `reserve`) `O(1)`. To achieve this `reserve` must exponentialy grow its capacity when it does reallocation. There's better strategy to implement `reserve`: ``` let new_capacity = max(current_capacity * 2, requested_capacity); ``` This strategy still guarantees that capacity grows at `O(1)` with `reserve`, and fixes the issue with `extend`. Patch imlpements this strategy.
2015-10-31Fix excessive memory allocation in RawVec::reserveStepan Koltsov-3/+49
Before this patch `reserve` function allocated twice as requested amount elements (not twice as capacity). It leaded to unnecessary excessive memory usage in scenarios like this: ``` let mut v = Vec::new(); v.push(17); v.extend(0..10); println!("{}", v.capacity()); ``` `Vec` allocated 22 elements, while it could allocate just 11. `reserve` function must have a property of keeping `push` operation cost (which calls `reserve`) `O(1)`. To achieve this `reserve` must exponentialy grow its capacity when it does reallocation. There's better strategy to implement `reserve`: ``` let new_capacity = max(current_capacity * 2, requested_capacity); ``` This strategy still guarantees that capacity grows at `O(1)` with `reserve`, and fixes the issue with `extend`. Patch imlpements this strategy.
2015-10-30don't use drop_in_place as an intrinsicAlexis Beingessner-4/+4
2015-10-30expose drop_in_place as ptr::drop_in_placeAlexis Beingessner-0/+2
2015-10-30Typo fixSimon Sapin-1/+1
… I think.
2015-10-17Remove some trivial `transmute`sAndrew Paseltiner-1/+1
`rbml::writer::Encoder::unsafe_clone` had no users across the entire repo.
2015-10-16Add `Shared` pointer and have `{Arc, Rc}` use itAndrew Paseltiner-10/+13
This change has two consequences: 1. It makes `Arc<T>` and `Rc<T>` covariant in `T`. 2. It causes the compiler to reject code that was unsound with respect to dropck. See compile-fail/issue-29106.rs for an example of code that no longer compiles. Because of this, this is a [breaking-change]. Fixes #29037. Fixes #29106.