about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2018-10-31Speed up String::from_utf16ljedrz-1/+9
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-29Fix documentation for those that allocate on heapdaniellimws-3/+4
2018-10-29Add documentation for From implsdaniellimws-0/+53
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-05Linkify types in docsHavvy (Ryan Scheel)-1/+1
2018-10-05Slice total example: Move closer to total defnHavvy (Ryan Scheel)-6/+9
2018-10-05Example of total ord of elements for sort_byHavvy (Ryan Scheel)-0/+6
2018-10-05Doc total order requirement of sort(_unstable)_byHavvy (Ryan Scheel)-0/+7
I took the definition of what a total order is from the Ord trait docs. I specifically put "elements of the slice" because if you have a slice of f64s, but know none are NaN, then sorting by partial ord is total in this case. I'm not sure if I should give such an example in the docs or not.
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