std: Second pass stabilization for string
#20306
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit performs a second pass over the
std::string
module, performing thefollowing actions:
std::string
is now stable.String::from_utf8
function is now stable after having been altered toreturn a new
FromUtf8Error
structure. TheFromUtf8Error
structure is nowstable as well as its
into_bytes
andutf8_error
methods.String::from_utf8_lossy
function is now stable.String::from_chars
method is now deprecated in favor of.collect()
String::from_raw_parts
method is now stableString::from_str
function remains experimentalString::from_raw_buf
function remains experimentalString::from_raw_buf_len
function remains experimentalString::from_utf8_unchecked
function is now stableString::from_char
function is now deprecated in favor ofrepeat(c).take(n).collect()
String::grow
function is now deprecated in favor of.extend(repeat(c).take(n)
String::capacity
method is now stableString::reserve
method is now stableString::reserve_exact
method is now stableString::shrink_to_fit
method is now stableString::pop
method is now stableString::as_mut_vec
method is now stableString::is_empty
method is now stableIntoString
trait is now deprecated (there are no implementors)String::truncate
method is now stableString::insert
method is now stableString::remove
method is now stableString::push
method is now stableString::push_str
method is now stableString::from_utf16
function is now stable after its error type has nowbecome an opaque structure to carry more semantic information in the future.
A number of these changes are breaking changes, but the migrations should be
fairly straightforward on a case-by-case basis (outlined above where possible).
[breaking-change]