summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2017-05-23Stabilize library features for 1.18.0Steven Fackler-2/+1
Closes #38863 Closes #38980 Closes #38903 Closes #36648
2017-04-23Auto merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcrichtonbors-438/+0
Remove items that are unstable and deprecated This removes unstable items that have been deprecated for more than one cycle. - Since 1.16.0, `#![feature(enumset)]` - All of `mod collections::enum_set` - Since 1.15.0, `#![feature(borrow_state)]` - `cell::BorrowState` - `RefCell::borrow_state()` - Since 1.15.0, `#![feature(is_unique)]` - `Rc::is_unique()` (made private like `Arc::is_unique()`) - Since 1.15.0, `#![feature(rc_would_unwrap)]` - `Rc::would_wrap()` - Since 1.13.0, `#![feature(binary_heap_extras)]` - `BinaryHeap::push_pop()` - `BinaryHeap::replace()` - Since 1.12.0, `#![feature(as_unsafe_cell)]` - `Cell::as_unsafe_cell()` - `RefCell::as_unsafe_cell()` - Since 1.12.0, `#![feature(map_entry_recover_keys)]` - `btree_map::OccupiedEntry::remove_pair()` - `hash_map::OccupiedEntry::remove_pair()` - Since 1.11.0, `#![feature(float_extras)]` - `Float::nan()` - `Float::infinity()` - `Float::neg_infinity()` - `Float::neg_zero()` - `Float::zero()` - `Float::one()` - `Float::integer_decode()` - `f32::integer_decode()` - `f32::ldexp()` - `f32::frexp()` - `f32::next_after()` - `f64::integer_decode()` - `f64::ldexp()` - `f64::frexp()` - `f64::next_after()` - Since 1.11.0, `#![feature(zero_one)]` - `num::Zero` - `num::One`
2017-04-22Fix invalid linkageGuillaume Gomez-5/+5
2017-04-20Remove OccupiedEntry::remove_pairJosh Stone-7/+0
[unstable, deprecated since 1.12.0]
2017-04-20Remove BinaryHeap::{push_pop,replace}Josh Stone-114/+0
[unstable, deprecated since 1.13.0]
2017-04-20Remove EnumSetJosh Stone-317/+0
[unstable, deprecated since 1.16.0]
2017-04-20Auto merge of #41342 - GuillaumeGomez:btree-debug-infinite, r=alexcrichtonbors-14/+26
Fix debug infinite loop Fixes #41338.
2017-04-20Auto merge of #41191 - seanmonstar:spec-extend-vec-intoiter, r=alexcrichtonbors-8/+41
specialize Extend for Vec with IntoIter Before, `vec.extend(&other_vec)` was quite a bit faster than `vec.extend(other_vec)`. This allows extending by consuming a vec to use the same code as extending from a slice.
2017-04-19Rollup merge of #41380 - ollie27:stability, r=BurntSushiCorey Farwell-1/+11
Fix a few stability attributes These show up in rustdoc so need to be correct.
2017-04-19specialize Extend for Vec with IntoIterSean McArthur-8/+41
2017-04-19Fix debug infinite loopGuillaume Gomez-14/+26
2017-04-18Fix a few stability attributesOliver Middleton-1/+11
These show up in rustdoc so need to be correct.
2017-04-18Rollup merge of #40290 - 3Hren:master, r=aturonCorey Farwell-0/+20
Add `as_bytes()` for `FromUtf8Error`. This change allows to obtain an underlying invalid UTF-8 bytes without `FromUtf8Error` destruction. Such method may be useful for example in a library that attempts to save both valid and invalid UTF-8 strings in some struct and to be able to provide immutable access to it without destruction. Personally without this change I ended with `Result<String, (Vec<u8>, Utf8Error)`, which almost copies the functionality of `FromUtf8Error`, but allows immutable view access.
2017-04-16Auto merge of #40409 - mbrubeck:calloc, r=sfacklerbors-3/+71
Specialize Vec::from_elem to use calloc Fixes #38723. This specializes the implementation for `u8` only, but it could be extended to other zeroable types if desired. I haven't tested this extensively, but I did verify that it gives the expected performance boost for large `vec![0; n]` allocations with both alloc_system and jemalloc, on Linux. (I have not tested or even built the Windows code.)
2017-04-15Specialize Vec::from_elem for other numeric typesMatt Brubeck-0/+39
2017-04-15Specialize Vec::from_elem<u8> to use calloc or memsetMatt Brubeck-3/+32
Fixes #38723.
2017-04-14std::collections docs: Address issues that came up in PR #41286lukaramu-1/+20
* Bound: * Added another example using RangeArgument to illustrate how Bound maps to range endpoints. * Added a note to the existing example that says that it's better to use range syntax in most cases * Added missing /// line * binary_heap::PeakMut: s/Object representing/Structure wrapping * added collections/hash_set/struct.HashSet.html to linkchecker whitelist
2017-04-14refactor: add reason stringEvgeny Safronov-1/+1
2017-04-14fix: add feature to doc testsEvgeny Safronov-0/+1
2017-04-14Add `as_bytes()` for `FromUtf8Error`.Evgeny Safronov-0/+19
This change allows to obtain an underlying invalid UTF-8 bytes without `FromUtf8Error` destruction. Such method may be useful for example in a library that attempts to save both valid and invalid UTF-8 strings in some struct and to be able to provide immutable access to it without destruction.
2017-04-13Various consistency and phrasing fixes in std::collections' docslukaramu-9/+27
* Changed btree_map's and hash_map's Entry (etc.) docs to be consistent * Changed VecDeque's type and module summary sentences to be consistent with each other as well as with other summary sentences in the module * Changed HashMap's and HashSet's summary sentences to be less redundantly phrased and also more consistant with the other summary sentences in the module * Also, added an example to Bound
2017-04-13Various fixes throughout std::collections' docslukaramu-8/+18
* Added links where possible (limited because of facading) * Changed references to methods from `foo()` to `foo` in module docs * Changed references to methods from `HashMap::foo` to just `foo` in top-level docs for `HashMap` and the `default` doc for `DefaultHasher` * Various small other fixes
2017-04-13Update std::collections' docs to use iterator (etc.) boilerplatelukaramu-36/+154
This greatly improves consistency.
2017-04-13Auto merge of #41009 - scottmcm:toowned-clone-into, r=alexcrichtonbors-10/+68
Add a resource-reusing method to `ToOwned` `ToOwned::to_owned` generalizes `Clone::clone`, but `ToOwned` doesn't have an equivalent to `Clone::clone_from`. This PR adds such a method as `clone_into` under a new unstable feature `toowned_clone_into`. Analogous to `clone_from`, this has the obvious default implementation in terms of `to_owned`. I've updated the `libcollections` impls: for `T:Clone` it uses `clone_from`, for `[T]` I moved the code from `Vec::clone_from` and implemented that in terms of this, and for `str` it's a predictable implementation in terms of `[u8]`. Used it in `Cow::clone_from` to reuse resources when both are `Cow::Owned`, and added a test that `Cow<str>` thus keeps capacity in `clone_from` in that situation. The obvious question: is this the right place for the method? - It's here so it lives next to `to_owned`, making the default implementation reasonable, and avoiding another trait. But allowing method syntax forces a name like `clone_into`, rather than something more consistent like `owned_from`. - Another trait would allow `owned_from` and could support multiple owning types per borrow type. But it'd be another single-method trait that generalizes `Clone`, and I don't know how to give it a default impl in terms of `ToOwned::to_owned`, since a blanket would mean overlapping impls problems. I did it this way as it's simpler and many of the `Borrow`s/`AsRef`s don't make sense with `owned_from` anyway (`[T;1]:Borrow<[T]>`, `Arc<T>:Borrow<T>`, `String:AsRef<OsStr>`...). I'd be happy to re-do it the other way, though, if someone has a good solution for the default handling. (I can also update with `CStr`, `OsStr`, and `Path` once a direction is decided.)
2017-04-12Add ToOwned::clone_into (unstable as toowned_clone_into)Scott McMurray-10/+68
to_owned generalizes clone; this generalizes clone_from. Use to_owned to give it a default impl. Customize the impl for [T], str, and T:Clone. Use it in Cow::clone_from to reuse resources when cloning Owned into Owned.
2017-04-12Rollup merge of #41243 - projektir:prim_str_docs, r=GuillaumeGomezTim Neumann-13/+24
Minor nits in primitive str Some minor updates to linking, added some links, doc format, etc. r? @GuillaumeGomez
2017-04-12Minor nits in primitive strprojektir-13/+24
2017-04-11Rollup merge of #40559 - nagisa:manually-drop, r=alexcrichtonCorey Farwell-9/+4
Implement Manually Drop As the RFC has been from approx a week in FCP without any major comments, I’m taking the opportunity to submit the PR early.
2017-04-11Auto merge of #41096 - clarcharr:as_bytes_mut, r=alexcrichtonbors-3/+11
Reduce str transmutes, add mut versions of methods. When I was working on the various parts involved in #40380 one of the comments I got was the excess of transmutes necessary to make the changes work. This is part of a set of multiple changes I'd like to offer to fix this problem. I think that having these methods is reasonable because they're already possible via transmutes, and it makes the code that uses them safer. I can also add `pub(crate)` to these methods for now if the libs team would rather not expose them to the public without an RFC.
2017-04-10Apply clippy's doc_markdown improvements to libcollectionsAndre Bogus-20/+20
Since my last PR led to linker failure, I'm now taking much smaller steps. This only fixes some doc_markdown warnings; as they are in comments only, we shouldn't get any problems building.
2017-04-09Reduce str transmutes, add mut versions of methods.Clar Charr-3/+11
2017-04-09Move away from the ad-hoc NoDrop unionsSimonas Kazlauskas-9/+4
2017-04-06Fix Markdown issues in the docsOliver Middleton-1/+1
* Since the switch to pulldown-cmark reference links need a blank line before the URLs. * Reference link references are not case sensitive. * Doc comments need to be indented uniformly otherwise rustdoc gets confused.
2017-04-05Rollup merge of #41037 - stjepang:move-libxtest, r=alexcrichtonCorey Farwell-2/+6849
Move libXtest into libX/tests This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561. r? @alexcrichton
2017-04-05Rollup merge of #41065 - jorendorff:slice-rsplit-41020, r=alexcrichtonAriel Ben-Yehuda-0/+69
[T]::rsplit() and rsplit_mut(), #41020
2017-04-05Rollup merge of #40943 - Amanieu:offset_to, r=alexcrichtonAriel Ben-Yehuda-8/+5
Add ptr::offset_to This PR adds a method to calculate the signed distance (in number of elements) between two pointers. The resulting value can then be passed to `offset` to get one pointer from the other. This is similar to pointer subtraction in C/C++. There are 2 special cases: - If the distance is not a multiple of the element size then the result is rounded towards zero. (in C/C++ this is UB) - ZST return `None`, while normal types return `Some(isize)`. This forces the user to handle the ZST case in unsafe code. (C/C++ doesn't have ZSTs)
2017-04-05Rollup merge of #40909 - nagisa:fix-vec-placement, r=alexcrichtonAriel Ben-Yehuda-23/+23
Allow using Vec::<T>::place_back for T: !Clone The place_back was likely put into block with `T: Clone` bound by mistake.
2017-04-05Rollup merge of #41066 - steveklabnik:fix-links, r=frewsxcvCorey Farwell-2/+2
Fix links part of https://github.com/rust-lang/rust/issues/40912 []\n() is not actually a link. r? @frewsxcv @GuillaumeGomez
2017-04-05Rollup merge of #41019 - mandeep:fix-vec-swapremove-docs, r=BurntSushiCorey Farwell-2/+3
Fixed typo in doc comments for swap_remove While reading the Vec docs, I came across the docs for swap_remove. I believe there is a typo in the comment and ```return``` should be ```returns```. This PR fixes this issue. I also feel that the entire doc comment is a bit of a run-on and could be changed to something along the lines of ```Removes an element from anywhere in the vector and returns it. The vector is mutated and the removed element is replaced by the last element of the vector. ``` Thoughts?
2017-04-05Rollup merge of #40949 - stjepang:fix-vecdeque-docs, r=frewsxcvCorey Farwell-9/+9
Improve some docs for VecDeque r? @GuillaumeGomez
2017-04-04Fix linkssteveklabnik-2/+2
part of https://github.com/rust-lang/rust/issues/40912 []\n() is not actually a link.
2017-04-04add [T]::rsplit() and rsplit_mut() #41020Jason Orendorff-0/+69
2017-04-03Removed trailing whitespace on line 682mandeep-1/+1
2017-04-03Move libXtest into libX/testsStjepan Glavina-2/+6849
This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561.
2017-04-03Refactored swap_remove doc comment upon discussing with BurntSushi and ↵mandeep-2/+3
steveklabnik
2017-04-03Add ptr::offset_toAmanieu d'Antras-8/+5
2017-04-02Fixed typo in doc comments for swap_removemandeep-1/+1
2017-04-01Change wording for push_frontStjepan Glavina-1/+1
2017-03-31Rollup merge of #40935 - donniebishop:str_boilerplate_docs, r=steveklabnikCorey Farwell-2/+8
Modify str Structs descriptions References #29375. Modified descriptions of multiple structs to be more in line with structs found under [`std::iter`](https://doc.rust-lang.org/std/iter/#structs), such as [`Chain`](https://doc.rust-lang.org/std/iter/struct.Chain.html) and [`Enumerate`](https://doc.rust-lang.org/std/iter/struct.Enumerate.html)
2017-03-31Improve some docs for VecDequeStjepan Glavina-9/+9