about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2017-07-26Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturonbors-17/+7
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-26Rollup merge of #43455 - QuietMisdreavus:extend-spec-docs, r=steveklabnikMark Simulacrum-0/+6
add a note to Vec's Extend<&T> impl about its slice specialization From the regular documentation view, it's not at all apparent that [this specialization](https://github.com/rust-lang/rust/blob/5669c9988f50788b5ab5dee2d4538519d4e5663d/src/liballoc/vec.rs#L1879-L1891) exists for `slice::Iter`. This adds a documentation blurb to the Extend impl itself to note that this optimization exists.
2017-07-26Rollup merge of #42959 - SimonSapin:nonzero-checked, r=sfacklerMark Simulacrum-43/+68
Make the "main" constructors of NonZero/Shared/Unique return Option Per discussion in https://github.com/rust-lang/rust/issues/27730#issuecomment-303939441. This is a breaking change to unstable APIs. The old behavior is still available under the name `new_unchecked`. Note that only that one can be `const fn`, since `if` is currently not allowed in constant contexts. In the case of `NonZero` this requires adding a new `is_zero` method to the `Zeroable` trait. I mildly dislike this, but it’s not much worse than having a `Zeroable` trait in the first place. `Zeroable` and `NonZero` are both unstable, this can be reworked later.
2017-07-25add a note to Vec's Extend<&T> impl about its slice specializationQuietMisdreavus-0/+6
2017-07-25std: Stabilize the `str_{mut,box}_extras` featureAlex Crichton-4/+3
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 `utf8_error_error_len` featureAlex Crichton-1/+0
Stabilizes: * `Utf8Error::error_len` Closes #40494
2017-07-25std: Stabilize `str_checked_slicing` featureAlex Crichton-10/+4
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-24Rollup merge of #43374 - stjepang:fix-sort-randomization-comment, r=alexcrichtonMark Simulacrum-15/+18
Clarify that sort_unstable is deterministic @frankmcsherry complained that the documentation said "it is randomized but deterministic", which is a contradictory statement. This PR uses a different and clearer wording.
2017-07-22Use checked NonZero constructor instead of explicit null check in btreeSimon Sapin-6/+4
2017-07-22Add conversions from references to NonZero pointers, Unique, and SharedSimon Sapin-3/+3
2017-07-22Add Box::into_uniqueSimon Sapin-21/+48
2017-07-22Rename {NonZero,Shared,Unique}::new to new_uncheckedSimon Sapin-25/+25
2017-07-21Auto merge of #43318 - jhjourdan:jh/fix_weak_cound_MAX, r=alexcrichtonbors-1/+23
Fix in weak_count in Arc in the case the weak count is locked. In the case the weak count was locked, the weak_count function could return usize::MAX. We need to test this condition manually.
2017-07-21Clarify that sort_unstable is deterministicStjepan Glavina-15/+18
2017-07-20Auto merge of #43270 - petrochenkov:fixstab, r=alexcrichtonbors-2/+2
Fix checking for missing stability annotations This was a regression from https://github.com/rust-lang/rust/pull/37676 causing "unmarked API" ICEs like https://github.com/rust-lang/rust/issues/43027. r? @alexcrichton
2017-07-20Add test test_weak_count_lockedJacques-Henri Jourdan-0/+19
2017-07-19Add Vec::drain_filterAlexis Beingessner-0/+281
2017-07-18Fix in weak_count in Arc.Jacques-Henri Jourdan-1/+4
In the case the weak count was locked, the weak_count function could return usize::MAX. We need to test this condition manually.
2017-07-18Fix erroneous reference to Arc instead of RcLynn-1/+1
2017-07-16Fix checking for missing stability annotationsVadim Petrochenkov-2/+2
Remove couple of unnecessary `#![feature(staged_api)]`.
2017-07-13Add precondition to `Layout` that the `align` fit in a u32.Felix S. Klock II-7/+15
This precondition takes the form of a behavorial change in `Layout::from_size_align` (so it returns `None` if the `align` is too large) and a new requirement for safe usage of `Layout::from_size_align_unchecked`. Fix #30170.
2017-07-10Correct some stability attributesOliver Middleton-2/+2
These show up in rustdoc so need to be correct.
2017-07-06Auto merge of #42727 - alexcrichton:allocators-new, r=eddybbors-301/+238
rustc: Implement the #[global_allocator] attribute 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/1974 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-05rustc: Implement the #[global_allocator] attributeAlex Crichton-301/+238
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-05Auto merge of #43050 - stjepang:doc-vec-fix-parens, r=frewsxcvbors-1/+1
Minor fix in docs for Vec Added missing parentheses after `mem::size_of::<T>`.
2017-07-04Rollup merge of #43041 - andersk:dedup_by, r=alexcrichtonMark Simulacrum-4/+12
Document unintuitive argument order for Vec::dedup_by relation When trying to use `dedup_by` to merge some auxiliary information from removed elements into kept elements, I was surprised to observe that `vec.dedup_by(same_bucket)` calls `same_bucket(a, b)` where `b` appears before `a` in the vector, and discards `a` when true is returned. This argument order is probably a bug, but since it has already been stabilized, I guess we should document it as a feature and move on. (`Vec::dedup` also uses `==` with this unexpected argument order, but I figure that’s not important since `==` is expected to be symmetric with no side effects.)
2017-07-04Rollup merge of #42227 - ollie27:into_to_from, r=aturonMark Simulacrum-4/+4
Convert Intos to Froms. This is a resubmission of #42129 without `impl<T> From<Vec<T>> for Box<[T]>`.
2017-07-04Minor fix in docs for VecStjepan Glavina-1/+1
2017-07-04Auto merge of #43012 - scottmcm:delete-range-step-by, r=alexcrichtonbors-2/+1
Delete deprecated & unstable range-specific `step_by` Using the new one is annoying while this one exists, since the inherent method hides the one on iterator. Tracking issue: #27741 Replacement: #41439 Deprecation: #42310 for 1.19 Fixes #41477
2017-07-03Document unintuitive argument order for Vec::dedup_by relationAnders Kaseorg-4/+12
When trying to use dedup_by to merge some auxiliary information from removed elements into kept elements, I was surprised to observe that vec.dedup_by(same_bucket) calls same_bucket(a, b) where b appears before a in the vector, and discards a when true is returned. This argument order is probably a bug, but since it has already been stabilized, I guess we should document it as a feature and move on. (Vec::dedup also uses == with this unexpected argument order, but I figure that’s not important since == is expected to be symmetric with no side effects.) Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2017-07-02Auto merge of #43010 - stjepang:stabilize-sort-unstable, r=alexcrichtonbors-14/+15
Stabilize feature sort_unstable Closes #40585
2017-07-02Remove the remaining feature gatesStjepan Glavina-1/+0
2017-07-02Fix lint errorsStjepan Glavina-1/+0
2017-07-01Delete deprecated & unstable range-specific `step_by`Scott McMurray-2/+1
Replacement: 41439 Deprecation: 42310 for 1.19 Fixes 41477
2017-07-02Stabilize feature sort_unstableStjepan Glavina-12/+15
2017-07-01Auto merge of #42882 - stjepang:improve-sort-tests-and-benches, r=alexcrichtonbors-33/+76
Improve tests and benchmarks for slice::sort and slice::sort_unstable This PR just hardens the tests and improves benchmarks. More specifically: 1. Benchmarks don't generate vectors in `Bencher::iter` loops, but simply clone pregenerated vectors. 2. Benchmark `*_strings` doesn't allocate Strings in `Bencher::iter` loops, but merely clones a `Vec<&str>`. 3. Benchmarks use seeded `XorShiftRng` to be more consistent. 4. Additional tests for `slice::sort` are added, which test sorting on slices with several ascending/descending runs. The implementation identifies such runs so it's a good idea to test that scenario a bit. 5. More checks are added to `run-pass/vector-sort-panic-safe.rs`. Sort algorithms copy elements around a lot (merge sort uses an auxilliary buffer and pdqsort copies the pivot onto the stack before partitioning, then writes it back into the slice). If elements that are being sorted are internally mutable and comparison function mutates them, it is important to make sure that sort algorithms always use the latest "versions" of elements. New checks verify that this is true for both `slice::sort` and `slice::sort_unstable`. As a side note, all of those improvements were made as part of the parallel sorts PR in Rayon (nikomatsakis/rayon#379) and now I'm backporting them into libcore/libstd. r? @alexcrichton
2017-06-30Revert "Stabilize RangeArgument"Steven Fackler-12/+200
This reverts commit 143206d54d7558c2326212df99efc98110904fdb.
2017-06-29Rollup merge of #42901 - alexcrichton:alloc-one, r=sfacklerAriel Ben-Yehuda-1/+1
std: Fix implementation of `Alloc::alloc_one` This had an accidental `u8 as *mut T` where it was intended to have just a normal pointer-to-pointer cast. Closes #42827
2017-06-29Rollup merge of #42832 - rthomas:doc-fmt, r=steveklabnikAriel Ben-Yehuda-5/+3
Update docs for std::fmt::format #29355. This rewords and removes the `Arguments` section from the docs for fmt::format. r? @steveklabnik
2017-06-25std: Fix implementation of `Alloc::alloc_one`Alex Crichton-1/+1
This had an accidental `u8 as *mut T` where it was intended to have just a normal pointer-to-pointer cast. Closes #42827
2017-06-24Stabilize RangeArgumentSteven Fackler-200/+12
Move it and Bound to core::ops while we're at it. Closes #30877
2017-06-24Improve sort tests and benchmarksStjepan Glavina-33/+76
2017-06-24Auto merge of #42854 - razielgn:relaxed-debug-constraints-on-maps-iterators, ↵bors-4/+4
r=sfackler Relaxed Debug constraints on {HashMap,BTreeMap}::{Keys,Values}. I has hit by this yesterday too. 😄 And I've realised that Debug for BTreeMap::{Keys,Values} wasn't formatting just keys and values respectively, but the whole map. 🤔 Fixed #41924 r? @jonhoo
2017-06-23Rollup merge of #42825 - letheed:patch-1, r=alexcrichtonMark Simulacrum-1/+1
Fix ref as mutable ref in std::rc::Rc doc
2017-06-23Relax Debug constraints when debugging {HashMap,BTreeMap}::{Keys,Values}.Federico Ravasio-2/+2
Fixed #41924.
2017-06-23Correctly iterate on keys/values when debugging BTreeMap::{Keys,Values}.Federico Ravasio-2/+2
2017-06-23Removed as many "```ignore" as possible.kennytm-7/+25
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.