Skip to content

constify (the unstable) str::as_str - #145930

Merged
bors merged 1 commit into
rust-lang:masterfrom
GrigorenkoPV:const_str_as_str
Aug 28, 2025
Merged

constify (the unstable) str::as_str#145930
bors merged 1 commit into
rust-lang:masterfrom
GrigorenkoPV:const_str_as_str

Conversation

@GrigorenkoPV

@GrigorenkoPV GrigorenkoPV commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

Tracking issue: #130366

The method was not initially marked const presumably because it is only useful with Deref. But now that const traits seem to be a thing that can actually become real, why not make it const?

PR constifying Deref: #145279

@ghost ghost self-assigned this Aug 27, 2025

ghost commented Aug 27, 2025

Copy link
Copy Markdown

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@ghost ghost added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 27, 2025

ghost commented Aug 27, 2025

Copy link
Copy Markdown

Confused how this could have possibly passed CI without a rustc_const_unstable attribute…

ghost commented Aug 27, 2025

Copy link
Copy Markdown
Author

I think they got reworked a few months ago to inherit stability and feature name from the non-const attributes.

ghost commented Aug 27, 2025

Copy link
Copy Markdown

Right! Sorry, I was forgetting that this method is still unstable. Carry on, then.

ghost commented Aug 28, 2025

Copy link
Copy Markdown
Member

@bors r+ rollup

ghost commented Aug 28, 2025

Copy link
Copy Markdown

📌 Commit e06cd9f has been approved by joshtriplett

It is now in the queue for this repository.

@ghost ghost 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 Aug 28, 2025
@ghost ghost mentioned this pull request Aug 28, 2025
@ghost
ghost merged commit f6c56bc into rust-lang:master Aug 28, 2025
@ghost ghost added this to the 1.91.0 milestone Aug 28, 2025
@ghost
ghost deleted the const_str_as_str branch August 28, 2025 17:32
@ghost ghost mentioned this pull request Aug 27, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants