about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2018-11-15Rollup merge of #55901 - euclio:speling, r=petrochenkovPietro Albini-2/+2
fix various typos in doc comments
2018-11-15Rollup merge of #55530 - ljedrz:speed_up_String_from_utf16, r=SimonSapinPietro Albini-1/+9
Speed up String::from_utf16 Collecting into a `Result` is idiomatic, but not necessarily fast due to rustc not being able to preallocate for the resulting collection. This is fine in case of an error, but IMO we should optimize for the common case, i.e. a successful conversion. This changes the behavior of `String::from_utf16` from collecting into a `Result` to pushing to a preallocated `String` in a loop. According to [my simple benchmark](https://gist.github.com/ljedrz/953a3fb74058806519bd4d640d6f65ae) this change makes `String::from_utf16` around **twice** as fast.
2018-11-13fix various typos in doc commentsAndy Russell-2/+2
2018-11-13Rollup merge of #55889 - RalfJung:global-alloc, r=alexcrichtonkennytm-0/+4
global allocators: add a few comments These comments answer some questions that came up when I tried to understand how the control flow works for the global allocator, `Global` and `System`. r? @alexcrichton
2018-11-13Rollup merge of #55874 - denisvasilik:docs, r=alexcrichtonkennytm-0/+41
string: Add documentation for `From` impls Hi this is part of #51430. I'm a first time contributor, so I started with a small task adding a bit of documentation for From impls.
2018-11-13Rollup merge of #55843 - Axary:master, r=sfacklerkennytm-1/+17
add FromIterator<A> to Box<[A]>
2018-11-13Rollup merge of #55711 - kngwyu:btreemap-rangemut-doc, r=Mark-Simulacrumkennytm-3/+4
Format BtreeMap::range_mut example Before: ![image](https://user-images.githubusercontent.com/16046705/48049184-36517780-e1e1-11e8-8da2-a3ae858d5a76.png) After: ![image](https://user-images.githubusercontent.com/16046705/48049210-45382a00-e1e1-11e8-87b3-84ae60ef798e.png)
2018-11-12global allocators: add a few commentsRalf Jung-0/+4
2018-11-11Minor style guide corrections.Denis Vasilik-6/+6
2018-11-11std: Delete the `alloc_system` crateAlex Crichton-4/+1
This commit deletes the `alloc_system` crate from the standard distribution. This unstable crate is no longer needed in the modern stable global allocator world, but rather its functionality is folded directly into the standard library. The standard library was already the only stable location to access this crate, and as a result this should not affect any stable code.
2018-11-11Whitespace cleanup according to Rust's style guidelines.Denis Vasilik-3/+3
2018-11-11Added comments for trait implementations.Denis Vasilik-1/+28
2018-11-11Added comment for From trait implementation: boxed string slice to StringDenis Vasilik-0/+14
2018-11-11change attribute to stableAxary-1/+1
2018-11-11Merge branch 'master' of https://github.com/rust-lang/rustAxary-4/+8
2018-11-10add FromIterator<A> to Box<[A]>Axary-1/+17
2018-11-08Fix Rc/Arc allocation layoutMurarth-4/+8
* Rounds allocation layout up to a multiple of alignment * Adds a convenience method `Layout::pad_to_align` to perform rounding
2018-11-08Auto merge of #55366 - Amanieu:stable_layout, r=Amanieubors-0/+1
Add tracking issue for Layout methods (and some API changes) These methods are already useful when used with the stable global allocator API (stabilized in #51241). ```rust pub fn align_to(&self, align: usize) -> Result<Layout, LayoutErr>; pub fn padding_needed_for(&self, align: usize) -> usize; pub fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr>; pub fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutErr>; pub fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutErr>; pub fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutErr>; pub fn array<T>(n: usize) -> Result<Layout, LayoutErr>; ``` cc #32838 r? @SimonSapin
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-1/+1
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06Add a tracking issue for extra Layout methodsAmanieu d'Antras-0/+1
2018-11-06refactor: use shorthand fieldsteresy-1/+1
2018-11-06Format BtreeMap::range_mut examplekngwyu-3/+4
2018-11-05Auto merge of #54922 - murarth:rc-ub-fix, r=alexcrichtonbors-10/+14
Fix undefined behavior in Rc/Arc allocation Manually calculate allocation layout for `Rc`/`Arc` to avoid undefined behavior Closes #54908
2018-11-05Fix undefined behavior in Rc/Arc allocationMurarth-10/+14
Manually calculate allocation layout for `Rc`/`Arc` to avoid undefined behavior
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-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-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