summary refs log tree commit diff
path: root/src/libcore/str
AgeCommit message (Collapse)AuthorLines
2017-08-12std: Stabilize the `str_{mut,box}_extras` featureAlex Crichton-4/+4
Stabilizes * `<&mut str>::as_bytes_mut` * `<Box<str>>::into_boxed_bytes` * `std::str::from_boxed_utf8_unchecked` * `std::str::from_utf8_mut` * `std::str::from_utf8_unchecked_mut` Closes #41119
2017-08-12std: Stabilize `utf8_error_error_len` featureAlex Crichton-1/+1
Stabilizes: * `Utf8Error::error_len` Closes #40494
2017-08-12std: Stabilize `str_checked_slicing` featureAlex Crichton-10/+10
Stabilized * `<str>::get` * `<str>::get_mut` * `<str>::get_unchecked` * `<str>::get_unchecked_mut` Closes #39932
2017-07-13Forward more Iterator methods for str::BytesSimon Sapin-0/+38
These are overridden by slice::Iter
2017-06-17Inline StrSearcher::haystack()Alexander Bulaev-1/+4
2017-06-16Introduce tidy lint to check for inconsistent tracking issuesest31-1/+1
This commit * Refactors the collect_lib_features function to work in a non-checking mode (no bad pointer needed, and list of lang features). * Introduces checking whether unstable/stable tags for a given feature have inconsistent tracking issues. * Fixes such inconsistencies throughout the codebase.
2017-06-13Merge crate `collections` into `alloc`Murarth-1/+1
2017-06-04Add overflow checking for str::get with inclusive rangesScott McMurray-4/+12
Fixes #42401
2017-06-04Delegate str:Index(Mut) to SliceIndex<str>Scott McMurray-37/+18
Move any extra logic that the former had into the latter, so they're consistent.
2017-05-24Rollup merge of #42134 - scottmcm:rangeinclusive-struct, r=aturonMark Simulacrum-40/+19
Make RangeInclusive just a two-field struct Not being an enum improves ergonomics and consistency, especially since NonEmpty variant wasn't prevented from being empty. It can still be iterable without an extra "done" bit by making the range have !(start <= end), which is even possible without changing the Step trait. Implements merged https://github.com/rust-lang/rfcs/pull/1980; tracking issue https://github.com/rust-lang/rust/issues/28237. This is definitely a breaking change to anything consuming `RangeInclusive` directly (not as an Iterator) or constructing it without using the sugar. Is there some change that would make sense before this so compilation failures could be compatibly fixed ahead of time? r? @aturon (as FCP proposer on the RFC)
2017-05-21Make RangeInclusive just a two-field structScott McMurray-40/+19
Not being an enum improves ergonomics, especially since NonEmpty could be Empty. It can still be iterable without an extra "done" bit by making the range have !(start <= end), which is even possible without changing the Step trait. Implements RFC 1980
2017-05-20Auto merge of #42111 - ollie27:stab, r=Mark-Simulacrumbors-4/+4
Correct some stability versions These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-05-20Correct some stability versionsOliver Middleton-4/+4
These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-05-19Try to optimise char patternsSimonas Kazlauskas-1/+27
2017-04-28Explain why zero-length slices require a non-null pointerHenri Sivonen-1/+4
2017-04-09Reduce str transmutes, add mut versions of methods.Clar Charr-7/+32
2017-04-05Rollup merge of #40997 - donniebishop:from_utf8_linking, r=steveklabnikCorey Farwell-8/+15
Added links to types in from_utf8 description References #29375. Link to types mentioned in the documentation for `from_utf8` (`str`, `&[u8`], etc). Paragraphs were reformatted to keep any one line from being excessively long, but are otherwise unchanged.
2017-04-05Rollup merge of #40992 - donniebishop:utf8err_linking, r=alexcrichtonCorey Farwell-3/+8
Added links to from_utf8 methods in Utf8Error Referencing #29375. Linked the `from_utf8` methods for both `String` and `str` in the description. Also linked the `u8` to its documentation
2017-04-01Added links to types in from_utf8 descriptionDonnie Bishop-8/+15
2017-03-31Added links to from_utf8 methods in Utf8ErrorDonnie Bishop-3/+8
2017-03-31Rollup merge of #40935 - donniebishop:str_boilerplate_docs, r=steveklabnikCorey Farwell-7/+24
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-31Auto merge of #40737 - nagisa:safe-slicing-strs, r=BurntSushibors-23/+303
Checked slicing for strings cc https://github.com/rust-lang/rust/issues/39932
2017-03-30Remove parentheses in method referencesDonnie Bishop-8/+8
2017-03-30Modify Chars' descriptionDonnie Bishop-3/+7
2017-03-30Modify CharIndices' descriptionDonnie Bishop-1/+9
2017-03-30Modify Bytes' descriptionDonnie Bishop-4/+5
2017-03-30Modify Lines' descriptionDonnie Bishop-2/+6
2017-03-29Linked str in from_utf_uncheckedDonnie Bishop-1/+3
2017-03-27Rollup merge of #40824 - donniebishop:fromstr_docexample, r=steveklabnikAlex Crichton-0/+33
FromStr implementation example Referencing #29375. Added example implementation of FromStr trait to API Documentation
2017-03-25Change `try!` to `?`Donnie Bishop-2/+2
2017-03-25Remove trailing whitespaceDonnie Bishop-6/+6
2017-03-25FromStr implementation exampleDonnie Bishop-0/+33
2017-03-25Link ParseBoolError to from_str method of boolDonnie Bishop-1/+3
2017-03-22Rollup merge of #40722 - stjepang:doc-consistency-fixes, r=steveklabnikCorey Farwell-7/+7
Various fixes to wording consistency in the docs A bunch of random fixes, added punctuation, plurals, backticks, and so on... r? @steveklabnik
2017-03-22Tracking issue numbersSimonas Kazlauskas-10/+10
2017-03-22Checked (and unchecked) slicing for strings?Simonas Kazlauskas-23/+303
What is this magic‽
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-7/+7
2017-03-21str: Make docs consistently punctuatedSam Whited-1/+1
2017-03-20Auto merge of #40281 - jimmycuadra:try-from-from-str, r=aturonbors-2/+5
Rename TryFrom's associated type and implement str::parse using TryFrom. Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err". See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968. `TryFrom<&str>` and `FromStr` are equivalent, so have the latter provide the former to ensure that. Using `TryFrom` in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to suggest implementing `TryFrom<&str>` instead for new code. See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994 and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827. Refs #33417.
2017-03-17Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, ↵Corey Farwell-35/+35
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
2017-03-15Rename TryFrom's associated type and implement str::parse using TryFrom.Jimmy Cuadra-2/+5
Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err". See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968. TryFrom<&str> and FromStr are equivalent, so have the latter provide the former to ensure that. Using TryFrom in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to suggest implementing `TryFrom<&str>` instead for new code. See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994 and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827. Refs #33417.
2017-03-14Add tracking issue number for Utf8Error::error_lenSimon Sapin-1/+1
2017-03-14Replace Utf8Error::resume_from with Utf8Error::error_lenSimon Sapin-10/+12
Their relationship is: * `resume_from = error_len.map(|l| l + valid_up_to)` * error_len is always one of None, Some(1), Some(2), or Some(3). When I started using resume_from I almost always ended up subtracting valid_up_to to obtain error_len. Therefore the latter is what should be provided in the first place.
2017-03-14Add Utf8Error::resume_from, to help incremental and/or lossy decoding.Simon Sapin-22/+56
Without this, code outside of the standard library needs to reimplement most of the logic `from_utf8` to interpret the bytes after `valid_up_to()`.
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-35/+35
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
2017-03-01Only keep one copy of the UTF8_CHAR_WIDTH table.Simon Sapin-0/+7
… instead of one of each of libcore and libstd_unicode. Move the `utf8_char_width` function to `core::str` under the `str_internals` unstable feature.
2017-02-16Additional docs for Vec, String, and slice trait implsMatt Brubeck-0/+14
2017-02-09name anonymous fn parameters in libcore traitsTrevor Spiteri-3/+3
2017-01-12Auto merge of #37926 - bluss:from-utf8-small-simplification, r=sfacklerbors-27/+26
UTF-8 validation: Compute block end upfront Simplify the conditional used for ensuring that the whole word loop is only used if there are at least two whole words left to read. This makes the function slightly smaller and simpler, a 0-5% reduction in runtime for various test cases.
2017-01-03Auto merge of #38066 - bluss:string-slice-error, r=sfacklerbors-4/+22
Use more specific panic message for &str slicing errors Separate out of bounds errors from character boundary errors, and print more details for character boundary errors. It reports the first error it finds in: 1. begin out of bounds 2. end out of bounds 3. begin <= end violated 3. begin not char boundary 5. end not char boundary. Example: &"abcαβγ"[..4] thread 'str::test_slice_fail_boundary_1' panicked at 'byte index 4 is not a char boundary; it is inside 'α' (bytes 3..5) of `abcαβγ`' Fixes #38052