about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2018-11-03Auto merge of #55238 - alexcrichton:rm-jemalloc, r=estebankbors-3/+0
Remove the `alloc_jemalloc` crate This commit removes the `alloc_jemalloc` crate from the standard library and all related configuration. We will no longer be shipping this unstable crate. Rationale for this is provided on https://github.com/rust-lang/rust/issues/36963 and the many linked issues, but I can inline rationale here if desired! We currently rely on jemalloc for increased perf in the Rust compiler, however. [This perf run shows](https://perf.rust-lang.org/compare.html?start=74ff7dcb1388e60a613cd6050bcd372a3cc4998b&end=7e7928dc0340d79b404e93f0c79eb4b946c1d669&stat=wall-time) that if we switch to glibc 2.23's allocator that it's slower than jemalloc across many benchmarks. [This perf run, however](https://perf.rust-lang.org/compare.html?start=22cc2ae8057d14e980b7c784e1eb2eee26b59e7d&end=10c95ccfa7a7adc12f4e608621ca29f9b98eed29), shows that if we use `jemalloc-sys` from crates.io then rustc actually gets faster across all benchmarks! (presumably because it has a more recent version of jemalloc than our submodule). As a result, it's expected that this doesn't regress any code (as it's just removing an unstable crate) and it should actually improve rustc performance because it updates jemalloc. Closes #36963
2018-11-02Remove all jemalloc-related contentAlex Crichton-3/+0
This commit removes all jemalloc related submodules, configuration, etc, from the bootstrap, from the standard library, and from the compiler. This will be followed up with a change to use jemalloc specifically as part of rustc on blessed platforms.
2018-11-01Replace CoerceSized trait with DispatchFromDynMichael Hewson-14/+14
Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {} ``` instead of ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {} ``` this way the trait is really just a subset of `CoerceUnsized`. The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too. I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
2018-11-01Add CoerceSized impls throughout libstdMichael Hewson-3/+18
This will make receiver types like `Rc<Self>` and `Pin<&mut Self>` object-safe.
2018-10-31Bump nightly to 1.32.0Alex Crichton-4/+2
* Also update the bootstrap compiler * Update cargo to 1.32.0 * Clean out stage0 annotations
2018-10-30Rollup merge of #55450 - japaric:msp430, r=alexcrichtonkennytm-0/+2
msp430: remove the whole Atomic* API PR #51953 enabled the Atomic*.{load,store} API on MSP430. Unfortunately, the LLVM backend doesn't currently support those atomic operations, so this commit removes the API and leaves instructions on how and when to enable it in the future. the second fixes compiling liballoc for msp430 closes #54511 r? @alexcrichton cc @chernomor @awygle @cr1901 @pftbest
2018-10-28msp430: fix compilation of liballocJorge Aparicio-0/+2
2018-10-27Update string.rsHsiang-Cheng Yang-1/+1
remove unused variable i in example String::with_capacity()
2018-10-23fix typos in various placesMatthias Krüger-1/+1
2018-10-18Stabilize slice::rchunks(), rchunks_mut(), rchunks_exact(), rchunk_exact_mut()Sebastian Dröge-3/+1
Fixes #55177
2018-10-18Stabilize slice::chunks_exact() and slice::chunks_exact_mut()Sebastian Dröge-3/+1
Fixes #47115
2018-10-18Auto merge of #54580 - sdroege:rchunks, r=SimonSapinbors-2/+118
Add slice::rchunks(), rchunks_mut(), rchunks_exact() and rchunks_exact_mut() These work exactly like the normal chunks iterators but start creating chunks from the end of the slice. ---- The new iterators were motivated by a [comment](https://github.com/rust-lang/rust/issues/47115#issuecomment-424141121) by @DutchGhost. ~~~This currently includes the commits from https://github.com/rust-lang/rust/pull/54537 to not have to rename things twice or have merge conflicts. I'll force-push a new version of the branch ones those are in master.~~~ Also the stabilization tracking issue is just some number right now. I'll create the corresponding issue once this is reviewed and otherwise mergeable. cc @DutchGhost
2018-10-18Add slice::rchunks(), rchunks_mut(), rchunks_exact() and rchunks_exact_mut()Sebastian Dröge-2/+118
These work exactly like the normal chunks iterators but start creating chunks from the end of the slice. See #55177 for the tracking issue
2018-10-18Rollup merge of #55050 - tshepang:repetition, r=steveklabnikkennytm-2/+1
doc std::fmt: the Python inspiration is already mentioned in precedin… …g paragraph
2018-10-14Auto merge of #55049 - tshepang:fix, r=withoutboatsbors-1/+1
doc: fix sentence structure in std::fmt
2018-10-13doc std::fmt: the Python inspiration is already mentioned in preceding paragraphTshepang Lekhonkhobe-2/+1
2018-10-13doc: fix sentence structure in std::fmtTshepang Lekhonkhobe-1/+1
2018-10-12`#[must_use]` for associated functions is supposed to actually workZack M. Davis-4/+4
In the comments of (closed, defunct) pull request #54884, Mazdak "Centril" Farrokhzad noted that must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a `Def::Method`, whereas the lint pass was only matching on `Def::Fn`. (One could argue that those def-names are thereby misleading—must-use for self-ful methods have always worked—but documenting or reworking that can be left to another day.)
2018-10-12Rollup merge of #54983 - kzys:rand-bench, r=tmandrykennytm-10/+13
Fix slice's benchmarks Fixes #54013.
2018-10-12Rollup merge of #54860 - mandeep:vec-initialize, r=alexcrichtonkennytm-1/+7
Add doc comments about safest way to initialize a vector of zeros This adds more information about the vec! macro as discussed in #54628. I think this is a good starting point, but I think additional detail is needed so that we can explain why vec! is safer than the alternatives.
2018-10-12Auto merge of #54924 - RalfJung:use-maybe-uninit2, r=cramertjbors-23/+21
Use MaybeUninit in liballoc All code by @japaric. This is a re-submission of a part of https://github.com/rust-lang/rust/pull/53508 that hopefully does not regress performance.
2018-10-10Fix slice's benchmarksKazuyoshi Kato-10/+13
Fixes #54013.
2018-10-10remove a now outdated commentRalf Jung-3/+0
2018-10-09Auto merge of #54613 - matthiaskrgr:string_from_inline_53681, r=nagisabors-0/+2
liballoc: mark str.to_owned() and String::from(&str) as #[inline]. Fixes #53681
2018-10-09address RalfJung's commentJorge Aparicio-6/+6
2018-10-09alloc: fix deprecated warningsJorge Aparicio-20/+21
2018-10-09Refactor macro comment and add resize with zeros examplemandeep-2/+6
2018-10-07Auto merge of #54835 - ↵bors-2/+2
oli-obk:mögen_konstante_funktionen_doch_bitte_endlich_stabil_sein, r=Centril Stabilize `min_const_fn` tracking issue: #53555 r? @Centril
2018-10-05Add doc comments about safest way to initialize a vector of zerosmandeep-1/+3
2018-10-05Revert "Slightly refactor VecDeque implementation"Alex Crichton-3/+3
This reverts commit 6ce76acae455a32113116cd2f95f8076388fc2d3.
2018-10-05Revert "Optimize VecDeque::append"Alex Crichton-27/+2
This reverts commit 11e488b64fed181820280d494d4fcc157ee1adc5.
2018-10-05Revert "Add docs and debug asserts"Alex Crichton-23/+11
This reverts commit 1a1a7f6167edf18b8a0ab488e651f7748cc2e9d3.
2018-10-05Revert "Fix tidy"Alex Crichton-2/+1
This reverts commit 1908892d3f60008f265dfc25ac46db387c0ad6a0.
2018-10-05Revert "Add another assert"Alex Crichton-4/+0
This reverts commit 21d2a6c9868541ec9829ced9a5bae936b18741c5.
2018-10-05Stabilize `min_const_fn`Oliver Schneider-2/+2
2018-10-05Auto merge of #54703 - davidtwco:issue-52086, r=nikomatsakisbors-0/+2
error message when trying to move from an Rc or Arc is ungreat Fixes #52086. r? @nikomatsakis
2018-10-02Make spec_extend use for_each()Nathan West-2/+2
2018-10-01Introduce language items for `Arc` and `Rc`.David Wood-0/+2
This commit introduces language items for `Arc` and `Rc` so that types can later be checked to be `Arc` or `Rc` in the NLL borrow checker. The `lang` attribute is currently limited to `stage1` as it requires a compiler built with knowledge of the expected language items.
2018-10-01Rollup merge of #54544 - frewsxcv:frewsxcv-deref, r=GuillaumeGomezkennytm-2/+13
Indicate how to move value out of Box in docs. Fixes https://github.com/rust-lang/rust/issues/53634.
2018-09-30Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrumbors-5/+3
Bump to 1.31.0 and bootstrap from 1.30 beta Closes #54594.
2018-09-29Revert "Auto merge of #53508 - japaric:maybe-uninit, r=RalfJung"Ralf Jung-21/+20
This reverts commit c6e3d7fa3113aaa64602507f39d4627c427742ff, reversing changes made to 4591a245c7eec9f70d668982b1383cd2a6854af5.
2018-09-28Indicate how to move value out of Box in docs.Corey Farwell-2/+13
Fixes https://github.com/rust-lang/rust/issues/53634.
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-5/+3
2018-09-27liballoc: mark str.to_owned() and String::from(&str) as #[inline].Matthias Krüger-0/+2
Fixes #53681
2018-09-25Rollup merge of #54537 - sdroege:chunks-exact, r=alexcrichtonPietro Albini-19/+19
Rename slice::exact_chunks() to slice::chunks_exact() See https://github.com/rust-lang/rust/issues/47115#issuecomment-403090815 and https://github.com/rust-lang/rust/issues/47115#issuecomment-424053547
2018-09-25Rollup merge of #54058 - Kerollmops:slice-dedup, r=shepmasterPietro Albini-89/+12
Introduce the partition_dedup/by/by_key methods for slices This PR propose to add three methods to the slice type, the `partition_dedup`, `partition_dedup_by` and `partition_dedup_by_key`. The two other methods are based on `slice::partition_dedup_by`. These methods take a mutable slice, deduplicates it and moves all duplicates to the end of it, returning two mutable slices, the first containing the deduplicated elements and the second all the duplicates unordered. ```rust let mut slice = [1, 2, 2, 3, 3, 2]; let (dedup, duplicates) = slice.partition_dedup(); assert_eq!(dedup, [1, 2, 3, 2]); assert_eq!(duplicates, [3, 2]); ``` The benefits of adding these methods is that it is now possible to: - deduplicate a slice without having to allocate and possibly clone elements on the heap, really useful for embedded stuff that can't allocate for example. - not loose duplicate elements, because, when using `Vec::dedup`, duplicates elements are dropped. These methods add more flexibillity to the user. Note that this is near a copy/paste of the `Vec::dedup_by` function, once this method is stable the goal is to replace the algorithm in `Vec` by the following. ```rust pub fn Vec::dedup_by<F>(&mut self, same_bucket: F) where F: FnMut(&mut T, &mut T) -> bool { let (dedup, _) = self.as_mut_slice().partition_dedup_by(same_bucket); let len = dedup.len(); self.truncate(len); } ```
2018-09-25Also rename ExactChunks iterator name to ChunksExactSebastian Dröge-1/+1
2018-09-24Rename slice::exact_chunks() to slice::chunks_exact()Sebastian Dröge-18/+18
See https://github.com/rust-lang/rust/issues/47115#issuecomment-403090815 and https://github.com/rust-lang/rust/issues/47115#issuecomment-424053547
2018-09-23Auto merge of #54339 - cramertj:no-cx, r=aturonbors-67/+4
Remove spawning from task::Context r? @aturon cc https://github.com/rust-lang-nursery/wg-net/issues/56
2018-09-23Make the `Vec::dedup` method use `slice::partition_dedup` internallyClément Renault-84/+7