Uh oh!
There was an error while loading. Please reload this page.
Add String::replace_first and String::replace_last - #134316
Conversation
rustbot
commented
Dec 14, 2024
tgross35
commented
Dec 14, 2024
I don't think I see any libs-api feedback on the other thread, and that is from a while back anyway. Could you file an ACP for this at https://github.com/rust-lang/libs-team/issues? |
tgross35
commented
Dec 14, 2024
These methods would be convenient but I feel like they should probably come with an in-place |
This comment has been minimized.
This comment has been minimized.
zachs18
commented
Dec 15, 2024
ACP opened: rust-lang/libs-team#506 @rustbot label S-waiting-on-ACP I added |
bors
commented
Jan 9, 2025
☔ The latest upstream changes (presumably #135286) made this pull request unmergeable. Please resolve the merge conflicts. |
@zachs18 |
tgross35
commented
Feb 21, 2025
This is still waiting on the ACP |
joshtriplett
commented
Oct 21, 2025
@bors r+ rollup ACP approved, PR approved. Might be interested in the proposed |
bors
commented
Oct 21, 2025
joshtriplett
commented
Oct 21, 2025
@bors r- r=me when the conflicts are fixed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tgross35
commented
Oct 21, 2025
Please also squash when you rebase, this PR has fixup commits |
Rebased and modified by zachs18. Co-authored-by: zachs18 <8355914+zachs18@users.noreply.github.com>
0243f5c to
8ed7fcaComparerustbot
commented
Oct 21, 2025
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Zalathar
commented
Oct 23, 2025
The GCC job failed again in rollup: #148010 (comment) @bors r- |
271b10c to
8ed7fcaComparetgross35
commented
Oct 23, 2025
@bors r=joshtriplett ,tgross35 |
bors
commented
Oct 23, 2025
Uh oh!
There was an error while loading. Please reload this page.
Rollup merge of #134316 - zachs18:string_replace_in_place_rebase, r=joshtriplett Add `String::replace_first` and `String::replace_last` Rebase of #97977 (cc `@WilliamVenner)` > Convenience methods that use `match_indices` and `replace_range` to efficiently replace a substring in a string without reallocating, if capacity (and the implementation of `Vec::splice`) allows. The intra-doc link to `str::replacen` is a direct url-based link to `str::replacen` in `std`'s docs to work around #98941. This means that when building only `alloc`'s docs (and not `std`'s), it will be a broken link. There is precedent for this e.g. in [`core::hint::spin_loop`](https://doc.rust-lang.org/nightly/src/core/hint.rs.html#214) which links to `std::thread::yield_now` using a [url-based link](https://github.com/rust-lang/rust/blob/master/library/core/src/hint.rs#L265) and thus is a dead link when only building `core`'s docs. ACP: rust-lang/libs-team#506
Rollup of 3 pull requests Successful merges: - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 3 pull requests Successful merges: - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 3 pull requests Successful merges: - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 3 pull requests Successful merges: - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
…base, r=joshtriplett Add `String::replace_first` and `String::replace_last` Rebase of rust-lang#97977 (cc `@WilliamVenner)` > Convenience methods that use `match_indices` and `replace_range` to efficiently replace a substring in a string without reallocating, if capacity (and the implementation of `Vec::splice`) allows. The intra-doc link to `str::replacen` is a direct url-based link to `str::replacen` in `std`'s docs to work around rust-lang#98941. This means that when building only `alloc`'s docs (and not `std`'s), it will be a broken link. There is precedent for this e.g. in [`core::hint::spin_loop`](https://doc.rust-lang.org/nightly/src/core/hint.rs.html#214) which links to `std::thread::yield_now` using a [url-based link](https://github.com/rust-lang/rust/blob/master/library/core/src/hint.rs#L265) and thus is a dead link when only building `core`'s docs. ACP: rust-lang/libs-team#506
Rollup of 3 pull requests Successful merges: - rust-lang#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
…base, r=joshtriplett Add `String::replace_first` and `String::replace_last` Rebase of rust-lang#97977 (cc `@WilliamVenner)` > Convenience methods that use `match_indices` and `replace_range` to efficiently replace a substring in a string without reallocating, if capacity (and the implementation of `Vec::splice`) allows. The intra-doc link to `str::replacen` is a direct url-based link to `str::replacen` in `std`'s docs to work around rust-lang#98941. This means that when building only `alloc`'s docs (and not `std`'s), it will be a broken link. There is precedent for this e.g. in [`core::hint::spin_loop`](https://doc.rust-lang.org/nightly/src/core/hint.rs.html#214) which links to `std::thread::yield_now` using a [url-based link](https://github.com/rust-lang/rust/blob/master/library/core/src/hint.rs#L265) and thus is a dead link when only building `core`'s docs. ACP: rust-lang/libs-team#506
Rollup of 3 pull requests Successful merges: - rust-lang#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 3 pull requests Successful merges: - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
…base, r=joshtriplett Add `String::replace_first` and `String::replace_last` Rebase of rust-lang#97977 (cc `@WilliamVenner)` > Convenience methods that use `match_indices` and `replace_range` to efficiently replace a substring in a string without reallocating, if capacity (and the implementation of `Vec::splice`) allows. The intra-doc link to `str::replacen` is a direct url-based link to `str::replacen` in `std`'s docs to work around rust-lang#98941. This means that when building only `alloc`'s docs (and not `std`'s), it will be a broken link. There is precedent for this e.g. in [`core::hint::spin_loop`](https://doc.rust-lang.org/nightly/src/core/hint.rs.html#214) which links to `std::thread::yield_now` using a [url-based link](https://github.com/rust-lang/rust/blob/master/library/core/src/hint.rs#L265) and thus is a dead link when only building `core`'s docs. ACP: rust-lang/libs-team#506
Rollup of 3 pull requests Successful merges: - rust-lang#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 3 pull requests Successful merges: - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 3 pull requests Successful merges: - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`) - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.) - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure ) r? `@ghost` `@rustbot` modify labels: rollup
Rebase of #97977 (cc @WilliamVenner)
The intra-doc link to
str::replacenis a direct url-based link tostr::replaceninstd's docs to work around #98941. This means that when building onlyalloc's docs (and notstd's), it will be a broken link. There is precedent for this e.g. incore::hint::spin_loopwhich links tostd::thread::yield_nowusing a url-based link and thus is a dead link when only buildingcore's docs.ACP: rust-lang/libs-team#506