Skip to content
New issue

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

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

Already on GitHub? # to your account

Make char and u8 methods const #82078

Merged
merged 4 commits into from
Feb 25, 2021
Merged

Make char and u8 methods const #82078

merged 4 commits into from
Feb 25, 2021

Conversation

lopopolo
Copy link
Contributor

@lopopolo lopopolo commented Feb 13, 2021

char methods len_utf8, len_utf16, to_ascii_lowercase, eq_ignore_ascii_case can be made const.

u8 methods to_ascii_lowercase, to_ascii_uppercase are required to be const as well.

u8::eq_ignore_ascii_case was additionally made const.

Rebase of #79549 originally authored by @YenForYang. Changes from that PR:

  • Squashed all commits from Make char and u8 methods const #79549.
  • rebased to latest upstream master.
  • Removed const attributes for char::escape_unicode and char::escape_default.
  • Updated since attributes for const stabilization to 1.52.0.

cc @m-ou-se.

@rust-highfive
Copy link
Contributor

r? @KodrAus

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 13, 2021
@m-ou-se m-ou-se assigned m-ou-se and unassigned KodrAus Feb 13, 2021
@m-ou-se m-ou-se added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 13, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Feb 13, 2021

@rfcbot merge

@rfcbot
Copy link
Collaborator

rfcbot commented Feb 13, 2021

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. labels Feb 13, 2021
@jonas-schievink jonas-schievink added the relnotes Marks issues that should be documented in the release notes of the next release. label Feb 13, 2021
@RalfJung
Copy link
Member

Cc @rust-lang/wg-const-eval
LGTM

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Feb 14, 2021
@rfcbot
Copy link
Collaborator

rfcbot commented Feb 14, 2021

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

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Feb 14, 2021
@jhpratt
Copy link
Member

jhpratt commented Feb 19, 2021

While these changes are all trivial, is it appropriate for these to go from non-existent to stable directly? I thought it was required that everything pass through nightly.

@dtolnay
Copy link
Member

dtolnay commented Feb 19, 2021

This will be on nightly for at least 6 weeks no matter what prior to a stable release. There is no requirement that something be on nightly for 12+ weeks. 6 is sufficient here.

@jhpratt
Copy link
Member

jhpratt commented Feb 19, 2021

Did not know that. I always assumed it had to be on nightly for a full cycle (thus shipping a beta with it unstable). Good to know, though, given that I'm going through a bunch of functions like this to see what can be const fn.

@bors
Copy link
Collaborator

bors commented Feb 23, 2021

☔ The latest upstream changes (presumably #82430) made this pull request unmergeable. Please resolve the merge conflicts.

YenForYang and others added 4 commits February 23, 2021 07:18
`escape_unicode`, `escape_default`, `len_utf8`, `len_utf16`, to_ascii_lowercase`, `eq_ignore_ascii_case`

`u8` methods `to_ascii_lowercase`, `to_ascii_uppercase` also must be made const

u8 methods made const

Update methods.rs

Update mod.rs

Update methods.rs

Fix `since` in rustc_const_stable to next stable

Fix `since` in rustc_const_stable to next stable

Update methods.rs

Update mod.rs
Rebases and makes changes required by the recent merge of #81837.
@lopopolo
Copy link
Contributor Author

Rebase and make a change to pull in #81837.

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Feb 24, 2021
@rfcbot
Copy link
Collaborator

rfcbot commented Feb 24, 2021

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.

The RFC will be merged soon.

@rfcbot rfcbot added the to-announce Announce this issue on triage meeting label Feb 24, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Feb 24, 2021

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 24, 2021

📌 Commit 1ed9dd4 has been approved by m-ou-se

@bors bors 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 Feb 24, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 24, 2021
Make char and u8 methods const

char methods `len_utf8`, `len_utf16`, `to_ascii_lowercase`, `eq_ignore_ascii_case` can be made const.

`u8` methods `to_ascii_lowercase`, `to_ascii_uppercase` are required to be const as well.

`u8::eq_ignore_ascii_case` was additionally made const.

Rebase of rust-lang#79549 originally authored by `@YenForYang.` Changes from that PR:

- Squashed all commits from rust-lang#79549.
- rebased to latest upstream master.
- Removed const attributes for `char::escape_unicode` and `char::escape_default`.
- Updated `since` attributes for `const` stabilization to 1.52.0.

cc `@m-ou-se.`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 25, 2021
Rollup of 16 pull requests

Successful merges:

 - rust-lang#75807 (Convert core/num/mod.rs to intra-doc links)
 - rust-lang#80534 (Use #[doc = include_str!()] in std)
 - rust-lang#80553 (Add an impl of Error on `Arc<impl Error>`.)
 - rust-lang#81167 (Make ptr::write const)
 - rust-lang#81575 (rustdoc: Name fields of `ResolutionFailure::WrongNamespace`)
 - rust-lang#81713 (Account for associated consts in the "unstable assoc item name colission" lint)
 - rust-lang#82078 (Make char and u8 methods const)
 - rust-lang#82087 (Fix ICE caused by suggestion with no code substitutions)
 - rust-lang#82090 (Do not consider using a semicolon inside of a different-crate macro)
 - rust-lang#82213 (Slices for vecs)
 - rust-lang#82214 (Remove redundant to_string calls)
 - rust-lang#82220 (fix the false 'defined here' messages)
 - rust-lang#82313 (Update normalize.css to 8.0.1)
 - rust-lang#82321 (AST: Remove some unnecessary boxes)
 - rust-lang#82364 (Improve error msgs when found type is deref of expected)
 - rust-lang#82514 (Update Clippy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Feb 25, 2021
@bors bors merged commit f891af9 into rust-lang:master Feb 25, 2021
@rustbot rustbot added this to the 1.52.0 milestone Feb 25, 2021
@jplatte jplatte mentioned this pull request Mar 2, 2021
65 tasks
@lopopolo lopopolo deleted the char-u8-const-fn branch April 22, 2021 00:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.