about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2018-08-18Auto merge of #52553 - Pazzaz:vecdeque-append, r=SimonSapinbors-2/+313
Non-naive implementation of `VecDeque.append` Replaces the old, simple implementation with a more manual (and **unsafe** 😱) one. I've added 1 more test and verified that it covers all 6 code paths in the function. This new implementation was about 60% faster than the old naive one when I tried benchmarking it.
2018-08-15Test VecDeque append not dropping twicePazzaz-0/+25
2018-08-15Clarify unused_as_mut_slicesPazzaz-3/+6
2018-08-14Add doc examples for std::alloc::{alloc,alloc_zeroed}.Corey Farwell-0/+31
2018-08-14Clarify dst conditionPazzaz-8/+8
2018-08-14Don't drop values in other, just move the tailPazzaz-7/+3
2018-08-11Add links to std::char::REPLACEMENT_CHARACTER from docs.Corey Farwell-2/+4
There are a few places where we mention the replacement character in the docs, and it could be helpful for users to utilize the constant which is available in the standard library, so let’s link to it!
2018-08-10Add benchmark for VecDeque appendPazzaz-0/+53
2018-08-09liballoc: enable feature(nll) for bootstrapmemoryruins-0/+1
2018-08-07Rollup merge of #53068 - MajorBreakfast:spawn, r=cramertjkennytm-5/+8
Rename Executor trait to Spawn Renames the `Executor` trait to `Spawn` and the method on `Context` to `spawner`. Note: Best only merge this after we've the alpha 3 announcement post ready. r? @cramertj
2018-08-06Rename Executor trait to SpawnJosef Reinhard Brandl-5/+8
2018-08-05Fix stage 2 testsvarkor-7/+3
2018-08-05Correct invalid feature attributesvarkor-1/+1
2018-08-05Remove unnecessary or invalid feature attributesvarkor-9/+1
2018-08-02Auto merge of #52949 - Mark-Simulacrum:snap, r=alexcrichtonbors-16/+4
Switch to bootstrapping from 1.29 beta r? @alexcrichton
2018-08-01Switch to bootstrapping from 1.29 betaMark Rousskov-16/+4
2018-07-31Use SetLenOnDrop in Vec::truncate()Laurentiu Nicola-6/+17
This avoids a redundant length check in some cases when calling `Vec::truncate` or `Vec::clear`. Fixes #51802
2018-07-28Rollup merge of #52769 - sinkuu:stray_test, r=alexcrichtonkennytm-19/+12
Incorporate a stray test `liballoc/repeat-generic-slice.rs` doesn't seem to be tested (I think it was intended to be placed in `run-pass`). This PR incorporates the test into `liballoc/tests`.
2018-07-27Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrumbors-9/+8
Rollup of bare_trait_objects PRs All deny attributes were moved into bootstrap so they can be disabled with a line of config. Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free. r? @Mark-Simulacrum cc @ljedrz @kennytm
2018-07-27Incorporate a stray testShotaro Yamada-19/+12
2018-07-25Deny bare_trait_objects globallyTatsuyuki Ishi-1/+0
2018-07-25Add missing dynTatsuyuki Ishi-8/+8
2018-07-24Impl Executor for Box<E: Executor>tinaun-1/+14
2018-07-24Auto merge of #52189 - cuviper:static-box-leak, r=blussbors-1/+3
doc: Clarify the lifetime returned by `Box::leak` `Box::leak` mentions that it can return a `'static` reference, but it wasn't immediately clear to me why it doesn't always do so. This is because of the `T: 'a` constraint needed to form a valid reference, and in general we want to be more flexible than requiring `T: 'static`. This patch tries to clarify the relationship between `T` and `'a`.
2018-07-23typosRalf Jung-4/+4
2018-07-23Don't use NonNull::dangling as sentinel valueRalf Jung-9/+17
Instead, rely on alignment and use usize::MAX as sentinel.
2018-07-22Make VecDeque append safer and easier to understandPazzaz-109/+131
2018-07-22Simplify vecdeque append testPazzaz-42/+64
2018-07-22Rollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichtonkennytm-9/+9
Deprecation of str::slice_unchecked(_mut) Closes #51715 I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version, for now it's 1.28.0. Additionally I've replaced `slice_unchecked` uses with `get_unchecked`. The only places where this method is still used are `src/liballoc/tests/str.rs` and `src/liballoc/tests/str.rs`.
2018-07-20data_structures: Add a reference wrapper for pointer-indexed maps/setsVadim Petrochenkov-1/+1
Use `ptr::eq` for comparing pointers
2018-07-19Non-naive implementation for `VecDeque.append`Pazzaz-2/+192
2018-07-18Rollup merge of #52116 - Pazzaz:match-str-case, r=SimonSapinkennytm-2/+27
Handle array manually in str case conversion methods Avoiding the overhead incurred from `String.extend(char.to_lowercase())` showed a notable performance improvement when I benchmarked it. I tested on these strings: ```rust ALL_LOWER: "loremipsumdolorsitametduosensibusmnesarchumabcdefgh" ALL_UPPER: "LOREMIPSUMDOLORSITAMETDUOSENSIBUSMNESARCHUMABCDEFGH" REALISTIC_UPPER: "LOREM IPSUM DOLOR SIT AMET, DUO SENSIBUS MNESARCHUM" SIGMAS: "ΣΣΣΣΣ ΣΣΣΣΣ ΣΣΣΣΣ ΣΣΣ ΣΣΣΣ, ΣΣΣ ΣΣΣΣΣΣΣΣ ΣΣΣΣΣΣΣΣΣΣ" WORD_UPPER: "Lorem Ipsum Dolor Sit Amet, Duo Sensibus Mnesarchum" ``` the performance improvements of `to_lowercase()` were ``` running 10 tests test tests::all_lower ... bench: 1,752 ns/iter (+/- 49) test tests::all_lower_new ... bench: 1,266 ns/iter (+/- 15) -28% test tests::all_upper ... bench: 1,832 ns/iter (+/- 39) test tests::all_upper_new ... bench: 1,337 ns/iter (+/- 18) -27% test tests::realistic_upper ... bench: 1,993 ns/iter (+/- 14) test tests::realistic_upper_new ... bench: 1,445 ns/iter (+/- 22) -27% test tests::sigmas ... bench: 1,342 ns/iter (+/- 39) test tests::sigmas_new ... bench: 1,226 ns/iter (+/- 16) -9% test tests::word_upper ... bench: 1,899 ns/iter (+/- 12) test tests::word_upper_new ... bench: 1,381 ns/iter (+/- 26) -27% ``` and of `to_uppercase()` ``` running 10 tests test tests::all_lower ... bench: 1,813 ns/iter (+/- 20) test tests::all_lower_new ... bench: 1,321 ns/iter (+/- 16) -27% test tests::all_upper ... bench: 1,629 ns/iter (+/- 22) test tests::all_upper_new ... bench: 1,241 ns/iter (+/- 9) -24% test tests::realistic_upper ... bench: 1,670 ns/iter (+/- 24) test tests::realistic_upper_new ... bench: 1,241 ns/iter (+/- 17) -26% test tests::sigmas ... bench: 2,053 ns/iter (+/- 20) test tests::sigmas_new ... bench: 1,753 ns/iter (+/- 23) -15% test tests::word_upper ... bench: 1,873 ns/iter (+/- 30) test tests::word_upper_new ... bench: 1,412 ns/iter (+/- 25) -25% ``` I gave up on the more advanced method from #52061 as it wasn't always a clear improvement and would help in even less cases if this PR was merged.
2018-07-11Revert borked changes in last commit.ljedrz-14/+15
2018-07-10Add missing dyn in liballocljedrz-37/+36
2018-07-10Deny bare trait objects in in src/liballocljedrz-12/+13
2018-07-09doc: Clarify the lifetime returned by `Box::leak`Josh Stone-1/+3
`Box::leak` mentions that it can return a `'static` reference, but it wasn't immediately clear to me why it doesn't always do so. This is because of the `T: 'a` constraint needed to form a valid reference, and in general we want to be more flexible than requiring `T: 'static`. This patch tries to clarify the relationship between `T` and `'a`.
2018-07-09Auto merge of #52159 - SimonSapin:alloc-prelude, r=alexcrichtonbors-1/+30
Add the `alloc::prelude` module It contains the re-exports that are in `std::prelude::v1` but not in `core::prelude::v1`. Calling it prelude is somewhat of a misnomer since (unlike those modules in `std` or `core`) its contents are never implicitly imported in modules. Rather it is intended to be used with an explicit glob import like `use alloc::prelude::*;`. However there is precedent for the same misnomer with `std::io::prelude`, for example. This new module is unstable with the same feature name as the `alloc` care. They are proposed for stabilization together in RFC https://github.com/rust-lang/rfcs/pull/2480.
2018-07-09Removed a single trailing space. Oops.Orson Peters-1/+1
2018-07-09Reimplemented Vec's swap_remove to not rely on pop.Orson Peters-4/+6
2018-07-09Performance improvement of Vec's swap_remove.Orson Peters-3/+7
2018-07-07Add the `alloc::prelude` moduleSimon Sapin-1/+30
It contains the re-exports that are in `std::prelude::v1` but not in `core::prelude::v1`. Calling it prelude is somewhat of a misnomer since (unlike those modules in `std` or `core`) its contents are never implicitly imported in modules. Rather it is intended to be used with an explicit glob import like `use alloc::prelude::*;`. However there is precedent for the same misnomer with `std::io::prelude`, for example. This new module is unstable with the same feature name as the `alloc` care. They are proposed for stabilization together in RFC https://github.com/rust-lang/rfcs/pull/2480
2018-07-06Rollup merge of #52103 - tmccombs:rc_downcast, r=Mark-SimulacrumMark Rousskov-4/+2
Stabilize rc_downcast Fixes #44608
2018-07-07Fix is_dangling import when Arc is #[cfg]’ed outSimon Sapin-7/+7
2018-07-07Add some unit tests for dangling Weak referencesSimon Sapin-0/+112
2018-07-07Rc: remove unused allocation from Weak::new()Simon Sapin-24/+37
Same as https://github.com/rust-lang/rust/pull/50357
2018-07-07Use an aligned dangling pointer in Weak::new, rather than address 1Simon Sapin-21/+29
2018-07-06Handle array manually in string case conversion methodsPazzaz-2/+27
2018-07-06Auto merge of #51953 - japaric:atomic-load-store, r=alexcrichtonbors-4/+16
enable Atomic*.{load,store} for ARMv6-M / MSP430 closes #45085 as proposed in https://github.com/rust-lang/rust/issues/45085#issuecomment-384825434 this commit adds an `atomic_cas` target option and extends the `#[cfg(target_has_atomic)]` attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS natively, like MSP430 and ARMv6-M. r? @alexcrichton
2018-07-06Stabilize rc_downcastThayne McCombs-4/+2
Fixes #44608
2018-07-05#[cfg(target_has_atomic_cas)] -> #[cfg(target_has_atomic = "cas")]Jorge Aparicio-9/+16