about summary refs log tree commit diff
path: root/src/liballoc/string.rs
AgeCommit message (Collapse)AuthorLines
2018-10-27Update string.rsHsiang-Cheng Yang-1/+1
remove unused variable i in example String::with_capacity()
2018-09-27liballoc: mark str.to_owned() and String::from(&str) as #[inline].Matthias Krüger-0/+1
Fixes #53681
2018-09-06Fix invalid urlsGuillaume Gomez-3/+1
2018-08-22docs: std::string::String.repeat(): slightly rephrase to be more in-line ↵Matthias Krüger-3/+3
with other descriptions. add ticks around a few keywords in other descriptions.
2018-08-20Replace usages of ptr::offset with ptr::{add,sub}.Corey Farwell-7/+7
2018-08-11Add links to std::char::REPLACEMENT_CHARACTER from docs.Corey Farwell-2/+4
There are a few places where we mention the replacement character in the docs, and it could be helpful for users to utilize the constant which is available in the standard library, so let’s link to it!
2018-07-22Rollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichtonkennytm-1/+1
Deprecation of str::slice_unchecked(_mut) Closes #51715 I am not sure if 1.28.0 or 1.29.0 should be used for deprecation version, for now it's 1.28.0. Additionally I've replaced `slice_unchecked` uses with `get_unchecked`. The only places where this method is still used are `src/liballoc/tests/str.rs` and `src/liballoc/tests/str.rs`.
2018-06-29Move core::alloc::CollectionAllocErr to alloc::collectionsSimon Sapin-1/+1
2018-06-26Deprecation of str::slice_uncheked(_mut)newpavlov-1/+1
2018-05-24stabilize RangeBounds collections_range #30877Cory Sherman-4/+4
rename RangeBounds::start() -> start_bound() rename RangeBounds::end() -> end_bound()
2018-05-17Rollup merge of #50170 - burtonageo:more_cow_from, r=alexcrichtonkennytm-0/+8
Implement From for more types on Cow This is basically https://github.com/rust-lang/rust/pull/48191, except that it should be implemented in a way that doesn't break third party crates.
2018-05-09Update features to 1.28.0George Burton-1/+1
2018-05-05make `String::new()` constF001-1/+2
2018-04-27Update the stable attributes to use the current nightly version numberGeorge Burton-1/+1
2018-04-22Implement From for more types on CowGeorge Burton-0/+8
2018-04-17Remove no longer necessary comparison to Vec::splice.Corey Farwell-3/+0
`String::replace_range` was previously called `String::splice`, so this note was necessary to differentiate it from the `Vec` method. Now that it's renamed, this note no longer seems necessary.
2018-04-17Rollup merge of #49555 - nox:inline-into-boxed, r=alexcrichtonkennytm-0/+1
Inline most of the code paths for conversions with boxed slices This helps with the specific problem described in #49541, obviously without making any large change to how inlining works in the general case. Everything involved in the conversions is made `#[inline]`, except for the `<Vec<T>>::into_boxed_slice` entry point which is made `#[inline(always)]` after checking that duplicating the function mentioned in the issue prevented its inlining if I only annotate it with `#[inline]`. For the record, that function was: ```rust pub fn foo() -> Box<[u8]> { vec![0].into_boxed_slice() } ``` To help the inliner's job, we also hoist a `self.capacity() != self.len` check in `<Vec<T>>::shrink_to_fit` and mark it as `#[inline]` too.
2018-04-14Cleanup liballoc use statementsMike Hommey-2/+2
Some modules were still using the deprecated `allocator` module, use the `alloc` module instead. Some modules were using `super` while it's not needed. Some modules were more or less ordering them, and other not, so the latter have been modified to match the others.
2018-04-12Reexport from core::unicode::char in core::char rather than vice versaSimon Sapin-1/+1
2018-04-12Deprecate the std_unicode crateSimon Sapin-1/+1
2018-04-12Move Utf8Lossy decoder to libcoreSimon Sapin-1/+1
2018-04-01Stabilize String::replace_rangeThayne McCombs-6/+5
Fixes #44643
2018-04-01Inline most of the code paths for conversions with boxed slicesAnthony Ramine-0/+1
This helps with the specific problem described in #49541, obviously without making any large change to how inlining works in the general case. Everything involved in the conversions is made `#[inline]`, except for the `<Vec<T>>::into_boxed_slice` entry point which is made `#[inline(always)]` after checking that duplicating the function mentioned in the issue prevented its inlining if I only annotate it with `#[inline]`. For the record, that function was: ```rust pub fn foo() -> Box<[u8]> { vec![0].into_boxed_slice() } ``` To help the inliner's job, we also hoist a `self.capacity() != self.len` check in `<Vec<T>>::shrink_to_fit` and mark it as `#[inline]` too.
2018-03-29Move RangeArguments to {core::std}::ops and rename to RangeBoundsSimon Sapin-4/+3
These unstable items are deprecated: * The `std::collections::range::RangeArgument` reexport * The `std::collections::range` module.
2018-03-29Move alloc::Bound to {core,std}::opsSimon Sapin-1/+1
The stable reexport `std::collections::Bound` is now deprecated. Another deprecated reexport could be added in `alloc`, but that crate is unstable.
2018-03-28Rollup merge of #49400 - Diggsey:shrink-to, r=joshtriplettkennytm-0/+28
Implement `shrink_to` method on collections Fixes #49385
2018-03-28Rollup merge of #49243 - murarth:stabilize-retain, r=BurntSushikennytm-3/+1
Stabilize method `String::retain` Closes #43874
2018-03-27Implement `shrink_to` method on collectionsDiggory Blake-0/+28
2018-03-21Stabilize method `String::retain`Murarth-3/+1
2018-03-17Stabilise FromUtf8Error::as_bytesvarkor-2/+1
Closes #40895.
2018-03-15Auto merge of #47813 - kennytm:stable-incl-range, r=nrcbors-4/+4
Stabilize inclusive range (`..=`) Stabilize the followings: * `inclusive_range` — The `std::ops::RangeInclusive` and `std::ops::RangeInclusiveTo` types, except its fields (tracked by #49022 separately). * `inclusive_range_syntax` — The `a..=b` and `..=b` expression syntax * `dotdoteq_in_patterns` — Using `a..=b` in a pattern cc #28237 r? @rust-lang/lang
2018-03-15Stabilize `inclusive_range` library feature.kennytm-4/+4
Stabilize std::ops::RangeInclusive and std::ops::RangeInclusiveTo.
2018-03-14implementing fallible allocation API (try_reserve) for Vec, String and HashMapsnf-0/+74
2018-03-03core: Update stability attributes for FusedIteratorUlrik Sverdrup-1/+1
2018-03-03core: Stabilize FusedIteratorUlrik Sverdrup-1/+1
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-22Small grammar fix to docs for String::new().Anthony Deschamps-1/+1
2018-01-06type error method suggestions use whitelisted identity-like conversionsZack M. Davis-0/+1
Previously, on a type mismatch (and if this wasn't preëmpted by a higher-priority suggestion), we would look for argumentless methods returning the expected type, and list them in a `help` note. This had two major shortcomings. Firstly, a lot of the suggestions didn't really make sense (if you used a &str where a String was expected, `.to_ascii_uppercase()` is probably not the solution you were hoping for). Secondly, we weren't generating suggestions from the most useful traits! We address the first problem with an internal `#[rustc_conversion_suggestion]` attribute meant to mark methods that keep the "same value" in the relevant sense, just converting the type. We address the second problem by making `FnCtxt.probe_for_return_type` pass the `ProbeScope::AllTraits` to `probe_op`: this would seem to be safe because grep reveals no other callers of `probe_for_return_type`. Also, structured suggestions are preferred (because they're pretty, but also for RLS and friends). Also also, we make the E0055 autoderef recursion limit error use the one-time-diagnostics set, because we can potentially hit the limit a lot during probing. (Without this, test/ui/did_you_mean/recursion_limit_deref.rs would report "aborting due to 51 errors"). Unfortunately, the trait probing is still not all one would hope for: at a minimum, we don't know how to rule out `into()` in cases where it wouldn't actually work, and we don't know how to rule in `.to_owned()` where it would. Issues #46459 and #46460 have been filed and are ref'd in a FIXME. This is hoped to resolve #42929, #44672, and #45777.
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-4/+1
2017-11-21fix some typosMartin Lindhe-1/+1
2017-11-03Remove unused AsciiExt imports and fix tests related to ascii methodsLukas Kalbertodt-2/+0
Many AsciiExt imports have become useless thanks to the inherent ascii methods added in the last commits. These were removed. In some places, I fully specified the ascii method being called to enforce usage of the AsciiExt trait. Note that some imports are not removed but tagged with a `#[cfg(stage0)]` attribute. This is necessary, because certain ascii methods are not yet available in stage0. All those imports will be removed later. Additionally, failing tests were fixed. The test suite should exit successfully now.
2017-09-17Updated tracking issue for String::splice and its unstable-book entryMichal Budzynski-1/+1
2017-09-14Rollup merge of #44572 - frewsxcv:frewsxcv-from-utf16-lossy, r=QuietMisdreavusCorey Farwell-0/+7
Clarify return type of `String::from_utf16_lossy`. Fixes https://github.com/rust-lang/rust/issues/32874
2017-09-14Rollup merge of #44453 - tommyip:doc_string_as_mut_str, r=frewsxcvCorey Farwell-1/+16
Add doc example to String::as_mut_str Fixes #44429.
2017-09-14Clarify return type of `String::from_utf16_lossy`.Corey Farwell-0/+7
Fixes https://github.com/rust-lang/rust/issues/32874
2017-09-10Add doc example to String::as_mut_strTommy Ip-1/+16
Fixes #44429.
2017-09-09Add doc example to String::as_strTommy Ip-0/+10
Fixes #44428.
2017-08-30Rollup merge of #44044 - mattico:string-splice-return, r=dtolnayAlex Crichton-90/+19
Remove Splice struct return value from String::splice The implementation is now almost identical to the one in the RFC. Fixes #44038 cc #32310
2017-08-26Remove Splice struct return value from String::spliceMatt Ickstadt-90/+19
2017-08-25Add missing link in string docGuillaume Gomez-1/+2
2017-08-18Add missing links for String module and typeGuillaume Gomez-32/+41