about summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
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
2017-03-31Auto merge of #40737 - nagisa:safe-slicing-strs, r=BurntSushibors-5/+114
Checked slicing for strings cc https://github.com/rust-lang/rust/issues/39932
2017-03-30Remove parentheses in method referencesDonnie Bishop-2/+2
2017-03-30Modify EncodeUtf16's descriptionDonnie Bishop-2/+8
2017-03-29Allow using Vec::<T>::place_back for T: !CloneSimonas Kazlauskas-23/+23
The place_back was likely put into block with `T: Clone` bound by mistake.
2017-03-28Rollup merge of #40731 - sfackler:vec-from-iter-spec, r=aturonCorey Farwell-4/+25
Specialize Vec::from_iter for vec::IntoIter It's fairly common to expose an API which takes an `IntoIterator` and immediately collects that into a vector. It's also common to buffer a bunch of items into a vector and then pass that into one of these APIs. If the iterator hasn't been advanced, we can make this `from_iter` simply reassemble the original `Vec` with no actual iteration or reallocation. r? @aturon
2017-03-28Rollup merge of #40682 - TigleyM:str_doc, r=steveklabnikCorey Farwell-1/+20
Update docs for std::str fixes #29375 I noticed there are docs for the `str` primitive type, which contained extensive examples, so my additions give a more general explanation of `&str`. But please let me know if something can be explained more or changed. r? @steveklabnik
2017-03-27Review request changesMicah Tigley-3/+3
2017-03-27Fix various useless derefs and slicingsOliver Schneider-1/+1
2017-03-24Rollup merge of #40790 - stepancheg:btreemap-drop, r=alexcrichtonCorey Farwell-2/+1
Unnecessary iteration in BTreeMap::drop `IntoIter::drop` already iterates.
2017-03-24Unnecessary iteration in BTreeMap::dropStepan Koltsov-2/+1
`IntoIter::drop` already iterates.
2017-03-23Fix markdown links to pdqsortStjepan Glavina-3/+3
2017-03-22Add 'the' before 'start'/'end'Stjepan Glavina-2/+2
2017-03-22Tracking issue numbersSimonas Kazlauskas-4/+4
2017-03-22Checked (and unchecked) slicing for strings?Simonas Kazlauskas-5/+114
What is this magic‽
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-32/+31
2017-03-22Specialize Vec::from_iter for vec::IntoIterSteven Fackler-4/+25
It's fairly common to expose an API which takes an `IntoIterator` and immediately collects that into a vector. It's also common to buffer a bunch of items into a vector and then pass that into one of these APIs. If the iterator hasn't been advanced, we can make this `from_iter` simply reassemble the original `Vec` with no actual iteration or reallocation.
2017-03-21Tweak the constants a bitStjepan Glavina-2/+2
2017-03-21Fix a doctestStjepan Glavina-1/+1
2017-03-21Address Alex's PR commentsStjepan Glavina-1/+7
2017-03-21Implement feature sort_unstableStjepan Glavina-77/+191
2017-03-20Fix Rust linting errorMicah Tigley-4/+5
2017-03-20Move str docs to proper place in file.Micah Tigley-22/+19
2017-03-20Update docs for std::strMicah Tigley-0/+21
2017-03-19Rollup merge of #40241 - Sawyer47:fix-39997, r=alexcrichtonCorey Farwell-0/+4
Change how the `0` flag works in format! Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. This also affects the '#' flag: zeroes are placed after the prefix (0b, 0o, 0x) and before the digits. Here's a short summary of how similar format strings work in Python and Rust: ``` :05 :<05 :>05 :^05 Python 3.6 |-0001| |-1000| |000-1| |0-100| Rust before |-0001| |-1000| |-0001| |-0100| Rust after |-0001| |-0001| |-0001| |-0001| :#05x :<#05x :>#05x :^#05x Python 3.6 |0x001| |0x100| |000x1| |00x10| Rust before |0x001| |0x100| |000x1| |0x010| Rust after |0x001| |0x001| |0x001| |0x001| ``` Fixes #39997 [breaking-change]
2017-03-19Rollup merge of #40646 - russmack:issue-40435-mention-none, r=frewsxcvCorey Farwell-4/+4
Add mention of None as possible return. Closes #40435. This commit adds a small mention to some methods that None is returned when the slice is empty.
2017-03-19Rollup merge of #40603 - QuietMisdreavus:slice-ptr-docs, r=GuillaumeGomezCorey Farwell-4/+4
minor wording tweak to slice::{as_ptr, as_mut_ptr} Per #37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
2017-03-19Add mention of None as possible return. Closes #40435.Russell Mackenzie-4/+4
2017-03-17Minor fixups to fix tidy errorsAlex Crichton-7/+4
2017-03-17Stabilize rc_raw feature, closes #37197Aaron Turon-20/+23
2017-03-17Stabilize btree_range, closes #27787Aaron Turon-11/+3
2017-03-17minor wording tweak to slice::{as_ptr, as_mut_ptr}QuietMisdreavus-4/+4
2017-03-17Rollup merge of #40536 - kevinmehall:dedup_docs_for_dedup_by, r=steveklabnikCorey Farwell-1/+5
Fix documentation for Vec::dedup_by. The previous docstring was copied from dedup_by_key.
2017-03-17Rollup merge of #40495 - llogiq:format-docs, r=steveklabnikCorey Farwell-1/+2
fix format grammar This is just a trivial change to get the escaped squigglies into the grammar. r? @steveklabnik
2017-03-17Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, ↵Corey Farwell-115/+115
r=GuillaumeGomez Remove function invokation parens from documentation links. This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md