about summary refs log tree commit diff
path: root/src/libcore/str
AgeCommit message (Collapse)AuthorLines
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.
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