summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2018-01-01[beta] Prepare the 1.24.0 beta releaseAlex Crichton-4/+2
* Update the channel of this release * Update the bootstrap compiler to the dev artifacts * Fix compile for last-minute backports
2018-01-01Auto merge of #47064 - kennytm:force-trailing-newlines, r=estebankbors-1/+1
Add a tidy check for missing or too many trailing newlines. I've noticed recently there are lots of review comments requesting to fix trailing newlines. If this is going to be an official style here, it's better to let the CI do this repetitive check.
2017-12-31Auto merge of #47004 - nvzqz:rc-conversions, r=bluss,kennytmbors-2/+4
Remove transmute in From<&str> impls for Arc/Rc Performs conversion via raw pointer casts.
2017-12-30Add trailing newlines to files which have no trailing newlines.kennytm-1/+1
2017-12-28Auto merge of #47036 - QuietMisdreavus:i-like-big-chars, r=frewsxcvbors-2/+6
update char_indices example to highlight big chars There was a comment today in IRC where someone thought `char_indices()` and `chars().enumerate()` were equivalent, so i wanted to put an example in the docs where that wasn't true. r? @rust-lang/docs
2017-12-27update char_indices example to highlight big charsQuietMisdreavus-2/+6
2017-12-26Rollup merge of #46930 - lucis-fluxum:patch-1, r=QuietMisdreavuskennytm-1/+1
Clarify docs for split_at_mut The `&mut` here didn't make immediate sense to me. Keep the docs for this function consistent with the non-mut version.
2017-12-25Remove transmute in From<&str> impls for Arc/RcNikolai Vazquez-2/+4
2017-12-21Clarify docs for split_at_mutLuc Street-1/+1
The `&mut` here didn't make immediate sense to me. Keep the docs for this function consistent with the non-mut version.
2017-12-20Clarify vec docs on deallocation (fixes #46879)Manish Goregaokar-2/+4
2017-12-16Move PhantomData<T> from Shared<T> to users of both Shared and #[may_dangle]Simon Sapin-13/+22
After discussing [1] today with @pnkfelix and @Gankro, we concluded that it’s ok for drop checking not to be much smarter than the current `#[may_dangle]` design which requires an explicit unsafe opt-in. [1] https://github.com/rust-lang/rust/issues/27730#issuecomment-316432083
2017-12-12Auto merge of #46411 - rillian:str_ascii, r=kennytmbors-12/+12
Mark ascii methods on primitive types stable in 1.23.0 not 1.21.0. The ascii_methods_on_intrinsics feature stabilization didn't land in time for 1.21.0. Update the annotation so the documentation is correct about when these methods became available.
2017-12-10Auto merge of #46602 - mbrubeck:try, r=kennytmbors-55/+15
Replace option_try macros and match with ? operator None
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-55/+15
2017-12-09Revert "Make drop impl stable for DrainFilter"Thayne McCombs-1/+1
This reverts commit 00acdbd51decd75ad10815ce7bcf3323830f95d6.
2017-12-07Make drop impl stable for DrainFilterThayne McCombs-1/+1
2017-12-07Add Drop impl for linked_list::DrainFilterThayne McCombs-0/+9
2017-12-06Rollup merge of #46378 - udoprog:benches-rand, r=kennytmCorey Farwell-2/+2
Fix use of rand in liballoc benches
2017-12-02Mark ascii methods on primitive types stable in 1.23.0.Ralph Giles-12/+12
The ascii_methods_on_intrinsics feature stabilization didn't land in time for 1.21.0. Update the annotation so the documentation is correct about when these methods became available.
2017-11-29Update bootstrap compilerAlex Crichton-21/+5
Also remove a number of `stage0` annotations and such
2017-11-29Fix use of rand in liballoc benchesJohn-John Tedro-2/+2
2017-11-29Rollup merge of #46219 - rust-lang:frewsxcv-issue-45636, r=GuillaumeGomezkennytm-13/+106
Improve documentation for slice swap/copy/clone operations. Fixes #45636. - Demonstrate how to use these operations with slices of differing lengths - Demonstrate how to swap/copy/clone sub-slices of a slice using `split_at_mut`
2017-11-29Rollup merge of #46077 - LukasKalbertodt:stabilize-ascii-ctype, r=alexcrichtonkennytm-261/+0
Stabilize some `ascii_ctype` methods As discussed in #39658, this PR stabilizes those methods for `u8` and `char`. All inherent `ascii_ctype` for `[u8]` and `str` are removed as we prefer the more explicit version `s.chars().all(|c| c.is_ascii_())`. This PR doesn't modify the `AsciiExt` trait. There, the `ascii_ctype` methods are still unstable. It is planned to remove those in the future (I think). I had to modify some code in `ascii.rs` to properly implement `AsciiExt` for all types. Fixes #39658.
2017-11-28Rollup merge of #46262 - udoprog:linked-list-remove-if, r=dtolnaykennytm-0/+327
Introduce LinkedList::drain_filter This introduces `LinkedList::remove_if`. This operation embodies one of the use-cases where `LinkedList` would typically be preferred over `Vec`: random removal and retrieval. There are a number of considerations with this: Should there be two `remove_if` methods? One where elements are only removed, one which returns a collection of removed elements. Should this be implemented using a draining iterator pattern that covers both cases? I suspect that would incur a bit of overhead (moving the element into the iterator, then into a new collection). But I'm not sure. Maybe that's an acceptable compromise to maximize flexibility. I don't feel I've had enough exposure to unsafe programming in rust to be certain the implementation is correct. This relies quite heavily on moving around copies of Shared pointers to make the code reasonable. Please help me out :).
2017-11-26Rollup merge of #46269 - udoprog:check-links, r=KodrAuskennytm-0/+7
Check tail node in check_links
2017-11-26Rollup merge of #46201 - davidalber:eprint-in-fmt-doc, r=frewsxcvkennytm-0/+10
Adding `eprint*!` to the list of macros in the `format!` family The `eprint!` and `eprintln!` macros were added in 7612727. The `std::fmt` documentation does not mention these macros next to `print!` and `println!` in the [Related macros](https://doc.rust-lang.org/std/fmt/#related-macros) section, and I did not find evidence that this omission was deliberate. This PR adds such documentation. The first modification is to add `eprint!` and `eprintln!` to the list of related macros in the `format!` family. This is how it appears with this change: ![image](https://user-images.githubusercontent.com/933552/33159527-67056caa-cfc8-11e7-8b7d-4224ef2fce4e.png) The second modification adds a sub-section for `eprint!` and `eprintln!`. Here is how the new section appears: ![image](https://user-images.githubusercontent.com/933552/33159541-97d03bee-cfc8-11e7-8b95-4d3632b5ab7b.png)
2017-11-26Check tail node in check_linksJohn-John Tedro-0/+7
2017-11-25Implement LinkedList::drain_filterJohn-John Tedro-35/+283
Relates to rust-lang/rfcs#2140 - drain_filter for all collections `drain_filter` is implemented instead of `LinkedList::remove_if` based on review feedback.
2017-11-25Introduce LinkedList::remove_ifJohn-John Tedro-0/+79
2017-11-25Auto merge of #46117 - SimonSapin:min-align, r=alexcrichtonbors-0/+49
allocators: don’t assume MIN_ALIGN for small sizes See individual commit messages.
2017-11-24Improve documentation for slice swap/copy/clone operations.Corey Farwell-13/+106
Fixes #45636. - Demonstrate how to use these operations with slices of differing lengths - Demonstrate how to swap/copy/clone sub-slices of a slice using `split_at_mut`
2017-11-23Auto merge of #46225 - GuillaumeGomez:rollup, r=GuillaumeGomezbors-9/+9
Rollup of 5 pull requests - Successful merges: #45635, #46177, #46190, #46218, #46220 - Failed merges:
2017-11-23Rollup merge of #46218 - rust-lang:frewsxcv-rename-slice-swap-param, r=kennytmGuillaume Gomez-9/+9
Rename param in `[T]::swap_with_slice` from `src` to `other`. The idea of ‘source’ and ‘destination’ aren’t very applicable for this operation since both slices can both be considered sources and destinations.
2017-11-23Auto merge of #45881 - Centril:box-leak, r=alexcrichtonbors-0/+53
Add Box::leak<'a>(Box<T>) -> &'a mut T where T: 'a Adds: ```rust impl<T: ?Sized> Box<T> { pub fn leak<'a>(b: Box<T>) -> &'a mut T where T: 'a { unsafe { &mut *Box::into_raw(b) } } } ``` which is useful for when you just want to put some stuff on the heap and then have a reference to it for the remainder of the program. r? @sfackler cc @durka
2017-11-22Adding `eprint*!` to the list of macros in the `format!` familyDavid Alber-0/+10
2017-11-22Rename param in `[T]::swap_with_slice` from `src` to `other`.Corey Farwell-9/+9
The idea of ‘source’ and ‘destination’ aren’t very applicable for this operation since both slices can both be considered sources and destinations.
2017-11-22Box::leak: update unstable issue number (46179).Mazdak-1/+1
2017-11-21fix some typosMartin Lindhe-8/+8
2017-11-21Rollup merge of #46128 - Coding-Doctors:patch-1, r=dtolnaykennytm-1/+1
Fix doc tests for trim_right_matches First pr, but isn't anything big so hopefully it should all be good.
2017-11-21Rollup merge of #46122 - malbarbo:docs, r=steveklabnikkennytm-1/+1
Fix some docs summary nits
2017-11-20Fix result for assert_eqBenjamin Hoffmeyer-1/+1
2017-11-20Fix doc tests for trim_right_matchesBenjamin Hoffmeyer-1/+1
2017-11-20Print the address of the pointed value in Pointer impl for Rc and ArcMarco A L Barbosa-2/+2
2017-11-20Fix some docs summary nitsMarco A L Barbosa-1/+1
2017-11-20alloc_jemalloc: don’t assume MIN_ALIGN for small sizesSimon Sapin-0/+5
See previous commit’s message for what is expected of allocators in general, and https://github.com/jemalloc/jemalloc/issues/1072 for discussion of what jemalloc does specifically.
2017-11-20alloc_system: don’t assume MIN_ALIGN for small sizes, fix #45955Simon Sapin-0/+44
The GNU C library (glibc) is documented to always allocate with an alignment of at least 8 or 16 bytes, on 32-bit or 64-bit platforms: https://www.gnu.org/software/libc/manual/html_node/Aligned-Memory-Blocks.html This matches our use of `MIN_ALIGN` before this commit. However, even when libc is glibc, the program might be linked with another allocator that redefines the `malloc` symbol and friends. (The `alloc_jemalloc` crate does, in some cases.) So `alloc_system` doesn’t know which allocator it calls, and needs to be conservative in assumptions it makes. The C standard says: https://port70.net/%7Ensz/c/c11/n1570.html#7.22.3 > The pointer returned if the allocation succeeds is suitably aligned > so that it may be assigned to a pointer to any type of object > with a fundamental alignment requirement https://port70.net/~nsz/c/c11/n1570.html#6.2.8p2 > A fundamental alignment is represented by an alignment less than > or equal to the greatest alignment supported by the implementation > in all contexts, which is equal to `_Alignof (max_align_t)`. `_Alignof (max_align_t)` depends on the ABI and doesn’t seem to have a clear definition, but it seems to match our `MIN_ALIGN` in practice. However, the size of objects is rounded up to the next multiple of their alignment (since that size is also the stride used in arrays). Conversely, the alignment of a non-zero-size object is at most its size. So for example it seems ot be legal for `malloc(8)` to return a pointer that’s only 8-bytes-aligned, even if `_Alignof (max_align_t)` is 16.
2017-11-19rustc: don't special-case Box<T> as having a pointer layout.Eduard-Mihai Burtescu-4/+14
2017-11-18Remove inherent `ascii_ctype` methods from `str` and `[u8]`Lukas Kalbertodt-261/+0
This has been discussed in #39658. It's a bit ambiguous how those methods work for a sequence of ascii values. We prefer users writing `s.iter().all(|b| b.is_ascii_...())` explicitly. The AsciiExt methods still exist and are implemented for `str` and `[u8]`. We will deprecated or remove those later.
2017-11-14examples in Cow::into_owned don't need to wrap result in CowsQuietMisdreavus-2/+2
2017-11-14Fixed several pulldown warnings when documenting libstd.kennytm-1/+1