Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for const [u8]::is_ascii (const_slice_is_ascii) #111090

Closed
1 of 3 tasks
scottmcm opened this issue May 2, 2023 · 5 comments · Fixed by #115449
Closed
1 of 3 tasks

Tracking Issue for const [u8]::is_ascii (const_slice_is_ascii) #111090

scottmcm opened this issue May 2, 2023 · 5 comments · Fixed by #115449
Labels
A-Unicode Area: Unicode C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. 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. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@scottmcm
Copy link
Member

scottmcm commented May 2, 2023

Feature gate: #![feature(const_slice_is_ascii)]

This is a tracking issue for [u8]::is_ascii being a const fn.

UTF-8 checking in const fn stabilized back in 1.63 (#97367), but apparently somehow simpler ASCII checking was never const-ified.

Public API

// core::slice

impl [u8] {
    const fn is_ascii(&self) -> bool;
}

// core::str

impl str {
    const fn is_ascii(&self) -> bool;
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@scottmcm scottmcm added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels May 2, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 6, 2023
Constify `[u8]::is_ascii` (unstably)

UTF-8 checking in `const fn`-stabilized back in 1.63 (rust-lang#97367), but apparently somehow ASCII checking was never const-ified, despite being simpler.

New constness-tracking issue for `is_ascii`: rust-lang#111090

I noticed this working on `ascii::Char`: rust-lang#110998
bors added a commit to rust-lang-ci/rust that referenced this issue May 7, 2023
Constify `[u8]::is_ascii` (unstably)

UTF-8 checking in `const fn`-stabilized back in 1.63 (rust-lang#97367), but apparently somehow ASCII checking was never const-ified, despite being simpler.

New constness-tracking issue for `is_ascii`: rust-lang#111090

I noticed this working on `ascii::Char`: rust-lang#110998
@workingjubilee workingjubilee added the A-Unicode Area: Unicode label Jul 22, 2023
@scottmcm scottmcm added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Aug 9, 2023
@scottmcm
Copy link
Member Author

scottmcm commented Aug 9, 2023

Hello libs-api! This hasn't been around that long, but I'd like to nominate it for stabilization.

str::from_utf8 has been const-stable since 1.63 (a year ago), so I'd like to also be able to use the substantially-simpler [u8]::is_ascii in const as well.

It can be implemented using only stable const fn support (https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=dd32ebaa5103731de9fab0ab4057f8bc), so this doesn't require exposing any new capabilities.

@m-ou-se
Copy link
Member

m-ou-se commented Aug 22, 2023

@rfcbot merge

@rfcbot
Copy link

rfcbot commented Aug 22, 2023

Team member @m-ou-se 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!

See this document for info about what commands tagged team members can give me.

@rfcbot 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. 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 Aug 22, 2023
@rfcbot
Copy link

rfcbot commented Aug 22, 2023

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

@m-ou-se m-ou-se removed the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Aug 29, 2023
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. 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. labels Sep 1, 2023
@rfcbot
Copy link

rfcbot commented Sep 1, 2023

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.

This will be merged soon.

fmease added a commit to fmease/rust that referenced this issue Sep 2, 2023
fmease added a commit to fmease/rust that referenced this issue Sep 2, 2023
@bors bors closed this as completed in 1bbd307 Sep 2, 2023
RalfJung pushed a commit to RalfJung/miri that referenced this issue Sep 3, 2023
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Unicode Area: Unicode C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. 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. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants