summary refs log tree commit diff
path: root/src/libcollections
AgeCommit message (Collapse)AuthorLines
2015-06-30Avoid overflow in Vec::from_iterSteven Fackler-2/+3
Closes #26550
2015-06-30Make `align_of` behave like `min_align_of`.Huon Wilson-16/+16
This removes a footgun, since it is a reasonable assumption to make that pointers to `T` will be aligned to `align_of::<T>()`. This also matches the behaviour of C/C++. `min_align_of` is now deprecated. Closes #21611.
2015-06-17std: Stabilize vec_map::Entry::or_insert{,_with}Alex Crichton-8/+7
These functions mirror the other Entry APIs of other maps, and were mistakenly just not stabilized the first time around.
2015-06-17More test fixes and fallout of stability changesAlex Crichton-10/+18
2015-06-17std: Stabilize the `str_matches` featureAlex Crichton-6/+4
This commit stabilizes the `str::{matches, rmatches}` functions and iterators, but renames the unstable feature for the `str::{matches,rmatches}_indices` function to `str_match_indices` due to the comment present on the functions about the iterator's return value.
2015-06-17std: Deprecate Vec::from_raw_bufAlex Crichton-0/+2
This function is more naturally expressed as slice::from_raw_buf plus a call to to_vec.
2015-06-17std: Deprecate all permutation-related slice methodsAlex Crichton-0/+6
These methods have been unstable for quite some time, and it's not clear that these should remain in the standard library.
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-118/+120
2015-06-17std: Split the `std_misc` featureAlex Crichton-1/+1
2015-06-17collections: Split the `collections` featureAlex Crichton-133/+148
This commit also deprecates the `as_string` and `as_slice` free functions in the `string` and `vec` modules.
2015-06-17alloc: Split apart the global `alloc` featureAlex Crichton-0/+3
2015-06-17core: Split apart the global `core` featureAlex Crichton-7/+23
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-17Auto merge of #22681 - mzabaluev:extend-faster, r=huonwbors-39/+39
Instead of a fast branch with a sized iterator falling back to a potentially poorly optimized iterate-and-push loop, a single efficient loop can serve all cases. In my benchmark runs, I see some good gains, but also some regressions, possibly due to different inlining choices by the compiler. YMMV.
2015-06-11Auto merge of #26190 - Veedrac:no-iter, r=alexcrichtonbors-18/+18
Pull request for #26188.
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-1/+1
2015-06-11Auto merge of #26154 - pmarcelll:master, r=Gankrobors-17/+17
Various methods in both libcore/char.rs and librustc_unicode/char.rs were previously marked with #[inline], now every method is marked in char's impl blocks. Partially fixes #26124. EDIT: I'm not familiar with pull reqests (yet), apparently Github added my second commit to thit PR... Fixes #26124
2015-06-11Auto merge of #26122 - bluss:borrow-box, r=alexcrichtonbors-1/+9
Implement Borrow<T> and BorrowMut<T> for Box<T: ?Sized>
2015-06-11Auto merge of #25839 - bluss:str-split-at-impl, r=alexcrichtonbors-45/+72
Implement RFC rust-lang/rfcs#1123 Add str method str::split_at(mid: usize) -> (&str, &str). Also a minor cleanup in the collections::str module. Remove redundant slicing of self.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-17/+17
2015-06-10Rollup merge of #26164 - tafia:early-dedup, r=GankroManish Goregaokar-1/+1
No need to dedup if there is only 1 element in the vec, can early return
2015-06-10Rollup merge of #26146 - steveklabnik:remove_unsafe_pointer, r=GankroManish Goregaokar-3/+3
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2015-06-10collections: Remove redundant slicing for strUlrik Sverdrup-45/+45
This is a remnant from a previous implementation of the str methods. Using `self` is fine now.
2015-06-10Add str::split_atUlrik Sverdrup-0/+27
Implement RFC rust-lang/rfcs#1123 Add str method str::split_at(mid: usize) -> (&str, &str).
2015-06-10Auto merge of #26130 - steveklabnik:gh25986, r=alexcrichtonbors-3/+28
This can be confusing when whitespace is the separator Fixes #25986
2015-06-10early return if 1 elementJohann Tuffe-1/+1
No need to dedup if there is only 1 element in the vec, can early return
2015-06-10Modify String::push to reallocate more conservatively in case of the ↵marcell-17/+17
character's UTF-8 representation is bigger than 1 byte
2015-06-09Exise 'unsafe pointer' in favor of 'raw pointer'Steve Klabnik-3/+3
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2015-06-09Auto merge of #26039 - SimonSapin:case-mapping, r=alexcrichtonbors-3/+32
* Add “complex” mappings to `char::to_lowercase` and `char::to_uppercase`, making them yield sometimes more than on `char`: #25800. `str::to_lowercase` and `str::to_uppercase` are affected as well. * Add `char::to_titlecase`, since it’s the same algorithm (just different data). However this does **not** add `str::to_titlecase`, as that would require UAX#29 Unicode Text Segmentation which we decided not to include in of `std`: https://github.com/rust-lang/rfcs/pull/1054 I made `char::to_titlecase` immediately `#[stable]`, since it’s so similar to `char::to_uppercase` that’s already stable. Let me know if it should be `#[unstable]` for a while. * Add a special case for upper-case Sigma in word-final position in `str::to_lowercase`: #26035. This is the only language-independent conditional mapping currently in `SpecialCasing.txt`. * Stabilize `str::to_lowercase` and `str::to_uppercase`. The `&self -> String` on `str` signature seems straightforward enough, and the only relevant issue I’ve found is #24536 about naming. But `char` already has stable methods with the same name, and deprecating them for a rename doesn’t seem worth it. r? @alexcrichton
2015-06-09Document str::split behavior with contiguous separatorsSteve Klabnik-3/+28
This can be confusing when whitespace is the separator Fixes #25986
2015-06-09Implement Borrow<T> and BorrowMut<T> for Box<T: ?Sized>Ulrik Sverdrup-1/+9
2015-06-09Auto merge of #26065 - Marwes:master, r=alexcrichtonbors-673/+674
PR for #26052 with the new order as written below. ``` //Querying fn len(&self) -> usize fn is_empty(&self) -> bool fn width(&self, is_cjk: bool) -> usize fn is_char_boundary(&self, index: usize) -> bool //Slicing and char retrieval fn as_bytes(&self) -> &[u8] fn as_ptr(&self) -> *const u8 unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str fn slice_chars(&self, begin: usize, end: usize) -> &str fn char_range_at(&self, start: usize) -> CharRange fn char_range_at_reverse(&self, start: usize) -> CharRange fn char_at(&self, i: usize) -> char fn char_at_reverse(&self, i: usize) -> char fn slice_shift_char(&self) -> Option<(char, &str)> //Iterators fn chars(&self) -> Chars fn char_indices(&self) -> CharIndices fn bytes(&self) -> Bytes fn split_whitespace(&self) -> SplitWhitespace fn words(&self) -> Words fn lines(&self) -> Lines fn lines_any(&self) -> LinesAny fn nfd_chars(&self) -> Decompositions fn nfkd_chars(&self) -> Decompositions fn nfc_chars(&self) -> Recompositions fn nfkc_chars(&self) -> Recompositions fn graphemes(&self, is_extended: bool) -> Graphemes fn grapheme_indices(&self, is_extended: bool) -> GraphemeIndices fn utf16_units(&self) -> Utf16Units //Searching fn contains<'a, P>(&'a self, pat: P) -> bool where P: Pattern<'a> fn starts_with<'a, P>(&'a self, pat: P) -> bool where P: Pattern<'a> fn ends_with<'a, P>(&'a self, pat: P) -> bool where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn find<'a, P>(&'a self, pat: P) -> Option<usize> where P: Pattern<'a> fn rfind<'a, P>(&'a self, pat: P) -> Option<usize> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn split<'a, P>(&'a self, pat: P) -> Split<'a, P> where P: Pattern<'a> fn rsplit<'a, P>(&'a self, pat: P) -> RSplit<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn split_terminator<'a, P>(&'a self, pat: P) -> SplitTerminator<'a, P> where P: Pattern<'a> fn rsplit_terminator<'a, P>(&'a self, pat: P) -> RSplitTerminator<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn splitn<'a, P>(&'a self, count: usize, pat: P) -> SplitN<'a, P> where P: Pattern<'a> fn rsplitn<'a, P>(&'a self, count: usize, pat: P) -> RSplitN<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn matches<'a, P>(&'a self, pat: P) -> Matches<'a, P> where P: Pattern<'a> fn rmatches<'a, P>(&'a self, pat: P) -> RMatches<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn match_indices<'a, P>(&'a self, pat: P) -> MatchIndices<'a, P> where P: Pattern<'a> fn rmatch_indices<'a, P>(&'a self, pat: P) -> RMatchIndices<'a, P> where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> fn subslice_offset(&self, inner: &str) -> usize //Trim fn trim(&self) -> &str fn trim_left(&self) -> &str fn trim_right(&self) -> &str fn trim_matches<'a, P>(&'a self, pat: P) -> &'a str where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a> fn trim_left_matches<'a, P>(&'a self, pat: P) -> &'a str where P: Pattern<'a> fn trim_right_matches<'a, P>(&'a self, pat: P) -> &'a str where P: Pattern<'a>, P::Searcher: ReverseSearcher<'a> //Conversion fn parse<F>(&self) -> Result<F, F::Err> where F: FromStr fn replace(&self, from: &str, to: &str) -> String fn to_lowercase(&self) -> String fn to_uppercase(&self) -> String fn escape_default(&self) -> String fn escape_unicode(&self) -> String ```
2015-06-08Auto merge of #26077 - SimonSapin:patch-6, r=alexcrichtonbors-5/+5
With the latter is provided by the `From` conversion trait, the former is now completely redundant. Their code is identical. Let’s deprecate now and plan to remove in the next cycle. (It’s `#[unstable]`.) r? @alexcrichton CC @nagisa
2015-06-08Reordered the methods on str to improve doc sortingMarkus Westerlind-673/+674
2015-06-08Address a review comment and fix a bootstrapping issueSimon Sapin-2/+7
2015-06-08Auto merge of #25989 - jooert:implement_rfc839, r=Gankrobors-0/+77
I had to use `impl<'a, V: Copy> Extend<(usize, &'a V)> for VecMap<V>` instead of `impl<'a, V: Copy> Extend<(&'a usize, &'a V)> for VecMap<V>` as that's what is needed for doing ```rust let mut a = VecMap::new(); let b = VecMap::new(); b.insert(1, "foo"); a.extend(&b) ``` I can squash the commits after review. r? @Gankro
2015-06-08Replace usage of String::from_str with String:fromSimon Sapin-3/+3
2015-06-08Implement RFC 839Johannes Oertel-0/+77
Closes #25976.
2015-06-08Auto merge of #25823 - oli-obk:static_to_const_lint, r=alexcrichtonbors-5/+5
r? @eddyb
2015-06-07Auto merge of #25912 - tshepang:better-str-examples, r=blussbors-50/+28
2015-06-07Deprecate String::from_str in favor of String::fromSimon Sapin-2/+2
With the latter is provided by the `From` conversion trait, the former is now completely redundant. Their code is identical.
2015-06-07doc: improve some of str examplesTshepang Lekhonkhobe-50/+28
2015-06-07change some statics to constantsOliver 'ker' Schneider-5/+5
2015-06-07Auto merge of #26066 - steveklabnik:docs_on_a_plane, r=alexcrichtonbors-2/+2
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-06-06Remove many unneeded feature annotations in the docsSteve Klabnik-2/+2
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-06-06Auto merge of #26050 - bluss:linked-list, r=Gankrobors-83/+132
The recent bug that was found in LinkedList reminded me of some general cleanup that's been waiting for some time. - Use a loop from the front in Drop, it works just as well and without an unsafe block - Change Rawlink methods to use `unsafe` in an idiomatic way. This does mean that we need an unsafe block for each dereference of a raw link. Even then, the extent of unsafe-critical code is even larger of course, since safety depends on the whole data structure's integrity. This is a general problem we are aware of. - Some cleanup just to try to decrease the amount of Rawlink handling.
2015-06-06Mark str::to_uppercase and str::to_lowercase as stable.Simon Sapin-2/+2
2015-06-06linked_list: Add Rawlink::fromUlrik Sverdrup-12/+14
2015-06-06linked_list: Add method Node::set_nextUlrik Sverdrup-11/+20
2015-06-06linked_list: Cleanup code in split_offUlrik Sverdrup-13/+37
2015-06-06linked_list: Use unsafe properly for Rawlink methodsUlrik Sverdrup-48/+70