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

Support char::encode_utf8 in const scenarios. #130511

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

bjoernager
Copy link
Contributor

This PR implements rust-lang/rfcs#3696.

This assumes const_slice_from_raw_parts_mut.

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ibraheemdev (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot 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 Sep 18, 2024
@rust-log-analyzer

This comment has been minimized.

@bjoernager
Copy link
Contributor Author

Checks complain about missing stability attribute but I'm not sure what version I should point it to.

@clubby789
Copy link
Contributor

#[rustc_const_unstable(feature = "const_char_encode_utf8", issue = "<tracking issue>")] should be used. You should create a tracking issue (like #91850) and use the issue number from that.

@clubby789 clubby789 added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 18, 2024
@tgross35
Copy link
Contributor

r? libs-api

@rustbot rustbot assigned dtolnay and unassigned ibraheemdev Sep 18, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bjoernager
Copy link
Contributor Author

bjoernager commented Sep 18, 2024

Should len_utf8 not have the must_use attribute? Reading "When to add #[must_use]" would suggest yes.

@rust-log-analyzer

This comment has been minimized.

@clubby789
Copy link
Contributor

Should len_utf8 not have the must_use attribute?

I wouldn't say so - methods like len don't. The attribute should be used when an issue would be caused by the value not being used - e.g. an un-handled error, expecting a value to be mutated when a function is actually pure, an iterator not being run. It's not an error to call a len function and not use the result (probably a mistake but not one that matters)

Also (once your code passes tests) you should squash your commits into one

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thank you!

@dtolnay
Copy link
Member

dtolnay commented Sep 18, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Sep 18, 2024

📌 Commit fb475e4 has been approved by dtolnay

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2024
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 18, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 19, 2024
… r=dtolnay

Support `char::encode_utf8` in const scenarios.

This PR implements [`rust-lang/rfcs#3696`](rust-lang/rfcs#3696).

This assumes [`const_slice_from_raw_parts_mut`](rust-lang#67456).
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 19, 2024
…kingjubilee

Rollup of 3 pull requests

Successful merges:

 - rust-lang#129755 (test: cross-edition metavar fragment specifiers)
 - rust-lang#130511 (Support `char::encode_utf8` in const scenarios.)
 - rust-lang#130531 (Check params for unsafety in THIR)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Sep 19, 2024

⌛ Testing commit fb475e4 with merge f8192ba...

@bors
Copy link
Contributor

bors commented Sep 19, 2024

☀️ Test successful - checks-actions
Approved by: dtolnay
Pushing f8192ba to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 19, 2024
@bors bors merged commit f8192ba into rust-lang:master Sep 19, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 19, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f8192ba): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.3%, 0.4%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.5%, -0.3%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.5%, 0.4%] 5

Max RSS (memory usage)

Results (primary 0.9%, secondary -1.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
10.7% [6.3%, 15.2%] 2
Regressions ❌
(secondary)
1.7% [1.7%, 1.7%] 1
Improvements ✅
(primary)
-3.0% [-4.0%, -1.3%] 5
Improvements ✅
(secondary)
-2.8% [-3.5%, -2.4%] 4
All ❌✅ (primary) 0.9% [-4.0%, 15.2%] 7

Cycles

Results (secondary 3.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.9% [2.1%, 4.6%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.0%, secondary 0.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.0%, 0.5%] 21
Regressions ❌
(secondary)
0.3% [0.0%, 0.5%] 67
Improvements ✅
(primary)
-0.1% [-0.4%, -0.0%] 30
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.4%, 0.5%] 51

Bootstrap: 767.849s -> 769.07s (0.16%)
Artifact size: 341.34 MiB -> 341.31 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. 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.

10 participants