Skip to content

stabilize String::into_chars - #163816

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
malezjaa:stabilize-String-into-chars
Oct 26, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
malezjaa:stabilize-String-into-chars

Conversation

@malezjaa

@malezjaa malezjaa commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #133125

History

Implementation: #133057

Public API

impl String {
    pub fn into_chars(self) -> IntoChars { .. }
}

#[cfg_attr(not(no_global_oom_handling), derive(Clone))]
pub struct IntoChars {}
impl fmt::Debug for IntoChars {}

impl IntoChars {
    pub fn as_str(&self) -> &str { .. }
    pub fn into_string(self) -> String { .. }
}

impl Iterator for IntoChars {}
impl DoubleEndedIterator for IntoChars {}
impl FusedIterator for IntoChars {}

@rustbot modify labels: +T-libs

No unresolved questions so, hoping to get a FCP started ^^

@malezjaa

malezjaa commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Huh?
r? libs

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Oct 5, 2026
@malezjaa malezjaa added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Oct 5, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 5, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

Probably desirable to derive(Clone) also as part of the stabilization, since that's particularly useful for iterators. Anyway,

@rfcbot merge libs

@rust-rfcbot

rust-rfcbot commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

@clarfonthey has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/libs-ping: FCP proposed for libs, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Oct 5, 2026
Comment on lines 3439 to 3441
pub struct IntoChars {
bytes: vec::IntoIter<u8>,
}

@clarfonthey clarfonthey Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is just a wrapper over vec::IntoIter, we could pretty easily derive(Clone) and support it. I would say that's useful since cloning iterators is pretty useful for debugging, even if it would allocate a copy here.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't it already have Clone?

#[cfg_attr(not(no_global_oom_handling), derive(Clone))]

Or did you mean that it should always derive(Clone)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I totally missed that line. You just didn't include it in the public API in the description is why I was confused.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I just copied the output from cargo unstable-api which didn't include the clone 😅 It's probably because it was in #[cfg_attr].

@ChrisDenton

ChrisDenton commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

I admit I felt a bit "meh" about this when I initially saw it but after looking at the motivation in the ACP, I think this is reasonable. And the tracking issue does seem to have gained some interest so there's at least some demand.

So +1 from me.

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Oct 15, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@clarfonthey clarfonthey added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 18, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

r=me pending FCP

@rust-rfcbot rust-rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. labels Oct 25, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

@jhpratt

jhpratt commented Oct 25, 2026

Copy link
Copy Markdown
Member

@bors r=@clarfonthey rollup

@rust-bors

rust-bors Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7d9c415 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 25, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 25, 2026
…rs, r=clarfonthey

stabilize String::into_chars

Closes rust-lang#133125

#### History
Implementation: rust-lang#133057

#### Public API
```rs
impl String {
    pub fn into_chars(self) -> IntoChars { .. }
}

#[cfg_attr(not(no_global_oom_handling), derive(Clone))]
pub struct IntoChars {}
impl fmt::Debug for IntoChars {}

impl IntoChars {
    pub fn as_str(&self) -> &str { .. }
    pub fn into_string(self) -> String { .. }
}

impl Iterator for IntoChars {}
impl DoubleEndedIterator for IntoChars {}
impl FusedIterator for IntoChars {}
```

@rustbot modify labels: +T-libs

No unresolved questions so, hoping to get a FCP started ^^
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 25, 2026
…rs, r=clarfonthey

stabilize String::into_chars

Closes rust-lang#133125

#### History
Implementation: rust-lang#133057

#### Public API
```rs
impl String {
    pub fn into_chars(self) -> IntoChars { .. }
}

#[cfg_attr(not(no_global_oom_handling), derive(Clone))]
pub struct IntoChars {}
impl fmt::Debug for IntoChars {}

impl IntoChars {
    pub fn as_str(&self) -> &str { .. }
    pub fn into_string(self) -> String { .. }
}

impl Iterator for IntoChars {}
impl DoubleEndedIterator for IntoChars {}
impl FusedIterator for IntoChars {}
```

@rustbot modify labels: +T-libs

No unresolved questions so, hoping to get a FCP started ^^
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #163730 (add tests over re-entrancy guarantees for 160776)
 - #164834 (miri subtree update)
 - #164849 (Use the span of the doctest code block fence for figuring out the line number)
 - #164883 (rustdoc: don't panic on a nested use group with no path prefix)
 - #164890 (Store cold blocks in a bitset instead of a Vec of bools)
 - #163458 (stabilize {Rc, Arc}::is_unique)
 - #163499 (vec: stabilise allocators for into_iter)
 - #163805 (std: check `SO_ERROR` after poll in `TcpStream::connect_timeout`)
 - #163816 (stabilize String::into_chars)
 - #163819 (Correct documentation of what `core::ops::Code` is.)
 - #163847 (add regression test for reborrow-invariant-type)
 - #164006 (Arduously fix typo)
 - #164009 (Update `Ready` future expect messages)
 - #164522 (Add IPv6 hop limit stubs to the motor OS net backend)
 - #164602 (Improve seek_read_buf_exact() test coverage to match seek_read_exact())
 - #164772 (docs: Two nitpick changes to `HashMap`, `BTreeMap` Entry API docs)
 - #164794 (Expose FloatErrorKind)
 - #164802 (Migrate stable-specific run-make tests to UI tests)
 - #164899 (Only recover if we may in `parse_expr_tuple_parens`)
 - #164903 (rustc-dev-guide subtree update)

Failed merges:

 - #164856 (Switch from `insta` to `expect-test` in bootstrap)
@rust-bors
rust-bors Bot merged commit a30d8c2 into rust-lang:main Oct 26, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 26, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 26, 2026
Rollup merge of #163816 - malezjaa:stabilize-String-into-chars, r=clarfonthey

stabilize String::into_chars

Closes #133125

#### History
Implementation: #133057

#### Public API
```rs
impl String {
    pub fn into_chars(self) -> IntoChars { .. }
}

#[cfg_attr(not(no_global_oom_handling), derive(Clone))]
pub struct IntoChars {}
impl fmt::Debug for IntoChars {}

impl IntoChars {
    pub fn as_str(&self) -> &str { .. }
    pub fn into_string(self) -> String { .. }
}

impl Iterator for IntoChars {}
impl DoubleEndedIterator for IntoChars {}
impl FusedIterator for IntoChars {}
```

@rustbot modify labels: +T-libs

No unresolved questions so, hoping to get a FCP started ^^
moabo3li pushed a commit to moabo3li/miri that referenced this pull request Oct 26, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - rust-lang/rust#163730 (add tests over re-entrancy guarantees for 160776)
 - rust-lang/rust#164834 (miri subtree update)
 - rust-lang/rust#164849 (Use the span of the doctest code block fence for figuring out the line number)
 - rust-lang/rust#164883 (rustdoc: don't panic on a nested use group with no path prefix)
 - rust-lang/rust#164890 (Store cold blocks in a bitset instead of a Vec of bools)
 - rust-lang/rust#163458 (stabilize {Rc, Arc}::is_unique)
 - rust-lang/rust#163499 (vec: stabilise allocators for into_iter)
 - rust-lang/rust#163805 (std: check `SO_ERROR` after poll in `TcpStream::connect_timeout`)
 - rust-lang/rust#163816 (stabilize String::into_chars)
 - rust-lang/rust#163819 (Correct documentation of what `core::ops::Code` is.)
 - rust-lang/rust#163847 (add regression test for reborrow-invariant-type)
 - rust-lang/rust#164006 (Arduously fix typo)
 - rust-lang/rust#164009 (Update `Ready` future expect messages)
 - rust-lang/rust#164522 (Add IPv6 hop limit stubs to the motor OS net backend)
 - rust-lang/rust#164602 (Improve seek_read_buf_exact() test coverage to match seek_read_exact())
 - rust-lang/rust#164772 (docs: Two nitpick changes to `HashMap`, `BTreeMap` Entry API docs)
 - rust-lang/rust#164794 (Expose FloatErrorKind)
 - rust-lang/rust#164802 (Migrate stable-specific run-make tests to UI tests)
 - rust-lang/rust#164899 (Only recover if we may in `parse_expr_tuple_parens`)
 - rust-lang/rust#164903 (rustc-dev-guide subtree update)

Failed merges:

 - rust-lang/rust#164856 (Switch from `insta` to `expect-test` in bootstrap)
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Oct 30, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - rust-lang/rust#163730 (add tests over re-entrancy guarantees for 160776)
 - rust-lang/rust#164834 (miri subtree update)
 - rust-lang/rust#164849 (Use the span of the doctest code block fence for figuring out the line number)
 - rust-lang/rust#164883 (rustdoc: don't panic on a nested use group with no path prefix)
 - rust-lang/rust#164890 (Store cold blocks in a bitset instead of a Vec of bools)
 - rust-lang/rust#163458 (stabilize {Rc, Arc}::is_unique)
 - rust-lang/rust#163499 (vec: stabilise allocators for into_iter)
 - rust-lang/rust#163805 (std: check `SO_ERROR` after poll in `TcpStream::connect_timeout`)
 - rust-lang/rust#163816 (stabilize String::into_chars)
 - rust-lang/rust#163819 (Correct documentation of what `core::ops::Code` is.)
 - rust-lang/rust#163847 (add regression test for reborrow-invariant-type)
 - rust-lang/rust#164006 (Arduously fix typo)
 - rust-lang/rust#164009 (Update `Ready` future expect messages)
 - rust-lang/rust#164522 (Add IPv6 hop limit stubs to the motor OS net backend)
 - rust-lang/rust#164602 (Improve seek_read_buf_exact() test coverage to match seek_read_exact())
 - rust-lang/rust#164772 (docs: Two nitpick changes to `HashMap`, `BTreeMap` Entry API docs)
 - rust-lang/rust#164794 (Expose FloatErrorKind)
 - rust-lang/rust#164802 (Migrate stable-specific run-make tests to UI tests)
 - rust-lang/rust#164899 (Only recover if we may in `parse_expr_tuple_parens`)
 - rust-lang/rust#164903 (rustc-dev-guide subtree update)

Failed merges:

 - rust-lang/rust#164856 (Switch from `insta` to `expect-test` in bootstrap)
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Oct 30, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - rust-lang/rust#163730 (add tests over re-entrancy guarantees for 160776)
 - rust-lang/rust#164834 (miri subtree update)
 - rust-lang/rust#164849 (Use the span of the doctest code block fence for figuring out the line number)
 - rust-lang/rust#164883 (rustdoc: don't panic on a nested use group with no path prefix)
 - rust-lang/rust#164890 (Store cold blocks in a bitset instead of a Vec of bools)
 - rust-lang/rust#163458 (stabilize {Rc, Arc}::is_unique)
 - rust-lang/rust#163499 (vec: stabilise allocators for into_iter)
 - rust-lang/rust#163805 (std: check `SO_ERROR` after poll in `TcpStream::connect_timeout`)
 - rust-lang/rust#163816 (stabilize String::into_chars)
 - rust-lang/rust#163819 (Correct documentation of what `core::ops::Code` is.)
 - rust-lang/rust#163847 (add regression test for reborrow-invariant-type)
 - rust-lang/rust#164006 (Arduously fix typo)
 - rust-lang/rust#164009 (Update `Ready` future expect messages)
 - rust-lang/rust#164522 (Add IPv6 hop limit stubs to the motor OS net backend)
 - rust-lang/rust#164602 (Improve seek_read_buf_exact() test coverage to match seek_read_exact())
 - rust-lang/rust#164772 (docs: Two nitpick changes to `HashMap`, `BTreeMap` Entry API docs)
 - rust-lang/rust#164794 (Expose FloatErrorKind)
 - rust-lang/rust#164802 (Migrate stable-specific run-make tests to UI tests)
 - rust-lang/rust#164899 (Only recover if we may in `parse_expr_tuple_parens`)
 - rust-lang/rust#164903 (rustc-dev-guide subtree update)

Failed merges:

 - rust-lang/rust#164856 (Switch from `insta` to `expect-test` in bootstrap)
@clarfonthey clarfonthey added the A-str Area: `str` and `String` label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-str Area: `str` and `String` disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking Issue for String::into_chars

6 participants