summary refs log tree commit diff
path: root/src/libcore/str
AgeCommit message (Collapse)AuthorLines
2018-04-21smaller PR just to fix #50002Michael Lamparski-7/+2
2018-03-17Add an example of lossy decoding to str::Utf8Error docsSimon Sapin-0/+31
2018-03-15Stabilize `inclusive_range` library feature.kennytm-18/+6
Stabilize std::ops::RangeInclusive and std::ops::RangeInclusiveTo.
2018-03-03core: Update stability attributes for FusedIteratorUlrik Sverdrup-7/+7
2018-03-03core: Stabilize FusedIteratorUlrik Sverdrup-7/+7
FusedIterator is a marker trait that promises that the implementing iterator continues to return `None` from `.next()` once it has returned `None` once (and/or `.next_back()`, if implemented). The effects of FusedIterator are already widely available through `.fuse()`, but with stable `FusedIterator`, stable Rust users can implement this trait for their iterators when appropriate.
2018-02-15spelling fix in commentSteve Klabnik-1/+1
2018-01-06Make double ended string searchers use dependent fingers (fixes #47175)Manish Goregaokar-6/+10
2018-01-05Rollup merge of #47030 - ollie27:stab, r=alexcrichtonkennytm-2/+6
Correct a few stability attributes * The extra impls for `ManuallyDrop` were added in #44310 which was only stabilised in 1.22.0. * The impls for `SliceIndex` were stabilised in #43373 but as `RangeInclusive` and `RangeToInclusive` are still unstable the impls should remain unstable. * The `From` impls for atomic integers were added in #45610 but most atomic integers are still unstable. * The `shared_from_slice2` impls were added in #45990 but they won't be stable until 1.24.0. * The `Mutex` and `RwLock` impls were added in #46082 but won't be stable until 1.24.0.
2018-01-01handle overflow/underflow in index offsetsManish Goregaokar-10/+15
2017-12-27Correct a few stability attributesOliver Middleton-2/+6
2017-12-18Add memchr search support for multibyte charactersManish Goregaokar-48/+102
2017-12-16Fill in reverse searcher impl for charManish Goregaokar-6/+50
2017-12-13Fill in forward searcher impl for charManish Goregaokar-13/+65
2017-12-13Move CharSearcher to its own section in the fileManish Goregaokar-83/+84
2017-12-13Split out char searcher from MultiCharSearcherManish Goregaokar-29/+58
2017-12-13Remove the unused ascii_only field in CharEqSearcherManish Goregaokar-16/+0
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-5/+4
2017-11-13Add missing links in FromStr docsGuillaume Gomez-2/+5
2017-10-02Inline eq_slice into str::eqleonardo.yvens-12/+1
It's the only use of the function.
2017-09-29Auto merge of #44174 - jimmycuadra:try-from-infallible, r=sfacklerbors-5/+2
Add blanket TryFrom impl when From is implemented. Adds `impl<T, U> TryFrom<T> for U where U: From<T>`. Removes `impl<'a, T> TryFrom<&'a str> for T where T: FromStr` (originally added in #40281) due to overlapping impls caused by the new blanket impl. This removal is to be discussed further on the tracking issue for TryFrom. Refs #33417. /cc @sfackler, @scottmcm (thank you for the help!), and @aturon
2017-09-23TrustedRandomAccess specialisation for Cloned.Clar Charr-1/+13
This verifies that TrustedRandomAccess has no side effects when the iterator item implements Copy. This also implements TrustedLen and TrustedRandomAccess for str::Bytes.
2017-09-23Rollup merge of #44658 - leodasvacas:remove-str-eq-lang-item, r=arielb1Corey Farwell-3/+0
Remove str_eq lang item It's not really a lang item. Also remove outdated note. The reference uses this as an example so it has to be updated.
2017-09-18Rollup merge of #44657 - Ixrec:patch-1, r=eddybAlex Crichton-4/+4
Replace str's transmute() calls with pointer casts After the following conversation in #rust-lang: ``` [14:43:50] <Ixrec> TIL the implementation of from_utf_unchecked is literally just "mem::transmute(x)" [14:43:59] <Ixrec> no wonder people keep saying transmute is overpowered [15:15:30] <eddyb> Ixrec: it should be a pointer cast lol [15:15:46] <eddyb> unless it doesn't let you [16:50:34] <Ixrec> https://play.rust-lang.org/?gist=d1e6b629ad9ec1baf64ce261c63845e6&version=stable seems like it does let me [16:52:35] <eddyb> Ixrec: yeah that's the preferred impl [16:52:46] <eddyb> Ixrec: it just wasn't in 1.0 [16:52:50] <eddyb> IIRC [16:53:00] <eddyb> (something something fat pointers) ``` Since I already wrote half of the preferred impls in the playground, might as well make an actual PR.
2017-09-17Add `<*const T>::align_offset` and use it in `memchr`Oliver Schneider-2/+1
2017-09-17missed a 'mut'Ixrec-1/+1
2017-09-17Remove unused str_eq lang itemleonardo.yvens-3/+0
It's not a lang item anymore. Also remove outdated note.
2017-09-17Replace str's transmute() calls with pointer castsIxrec-4/+4
After the following conversation in #rust-lang: ``` [14:43:50] <Ixrec> TIL the implementation of from_utf_unchecked is literally just "mem::transmute(x)" [14:43:59] <Ixrec> no wonder people keep saying transmute is overpowered [15:15:30] <eddyb> Ixrec: it should be a pointer cast lol [15:15:46] <eddyb> unless it doesn't let you [16:50:34] <Ixrec> https://play.rust-lang.org/?gist=d1e6b629ad9ec1baf64ce261c63845e6&version=stable seems like it does let me [16:52:35] <eddyb> Ixrec: yeah that's the preferred impl [16:52:46] <eddyb> Ixrec: it just wasn't in 1.0 [16:52:50] <eddyb> IIRC [16:53:00] <eddyb> (something something fat pointers) ``` Since I already wrote half of the preferred impls in the playground, might as well make an actual PR.
2017-09-14Rollup merge of #44477 - napen123:master, r=frewsxcvCorey Farwell-0/+13
Add doc examples to str::from_utf8_unchecked_mut Fixes #44461
2017-09-12Remove Invalid UTF-8 from str::from_utf8_unchecked_mutEthan Dagner-15/+0
2017-09-10Add doc examples to str::from_utf8_unchecked_mutEthan Dagner-0/+28
Fixes #44461
2017-09-10Actually fix the trailing whitespacesmt923-1/+1
2017-09-10Fix markdown link for Utf8Errorsmt923-1/+3
2017-09-10Fix trailing whitespacesmt923-1/+0
2017-09-10Fix incorrect markdown titlesmt923-1/+1
2017-09-10Added short examples for 'str::from_utf8_mut'smt923-0/+30
2017-08-30Auto merge of #43903 - oli-obk:alignto, r=aturonbors-1/+5
Add align_offset intrinsic see https://github.com/rust-lang/rfcs/pull/2043 for details and the plan towards stabilization (reexport in `core::mem` via various convenience functions) as per @scottmcm 's [comment](https://github.com/rust-lang/rfcs/pull/2043#issuecomment-316818169), this is just the intrinsic (which is obviously unstable).
2017-08-29Add blanket TryFrom impl when From is implemented.Jimmy Cuadra-5/+2
Adds `impl<T, U> TryFrom<T> for U where U: From<T>`. Removes `impl<'a, T> TryFrom<&'a str> for T where T: FromStr` due to overlapping impls caused by the new blanket impl. This removal is to be discussed further on the tracking issue for TryFrom. Refs #33417.
2017-08-21Add align_offset intrinsicOliver Schneider-1/+5
see https://github.com/rust-lang/rfcs/pull/2043 for details
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-12/+12
Like #43008 (f668999), but _much more aggressive_.
2017-07-25std: Stabilize the `str_{mut,box}_extras` featureAlex Crichton-3/+3
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-07-25std: Stabilize `utf8_error_error_len` featureAlex Crichton-1/+1
Stabilizes: * `Utf8Error::error_len` Closes #40494
2017-07-25std: 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-23Fix some doc/comment typos.Bruce Mitchener-4/+4
2017-07-20std: Cut down #[inline] annotations where not necessaryAlex Crichton-6/+6
This PR cuts down on a large number of `#[inline(always)]` and `#[inline]` annotations in libcore for various core functions. The `#[inline(always)]` annotation is almost never needed and is detrimental to debug build times as it forces LLVM to perform inlining when it otherwise wouldn't need to in debug builds. Additionally `#[inline]` is an unnecessary annoation on almost all generic functions because the function will already be monomorphized into other codegen units and otherwise rarely needs the extra "help" from us to tell LLVM to inline something. Overall this PR cut the compile time of a [microbenchmark][1] by 30% from 1s to 0.7s. [1]: https://gist.github.com/alexcrichton/a7d70319a45aa60cf36a6a7bf540dd3a
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.