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

Stabilise const_char_encode_utf16. #132153

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

bjoernager
Copy link
Contributor

@bjoernager bjoernager commented Oct 25, 2024

Closes: #130660

This PR stabilises the const_char_encode_utf16 feature gate (i.e. support for char::encode_utf16 in constant expressions).

Note that the linked tracking issue is as of this writing currently awaiting FCP until 2024-11-02.

@rustbot
Copy link
Collaborator

rustbot commented Oct 25, 2024

r? @cuviper

rustbot has assigned @cuviper.
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

@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 Oct 25, 2024
@bjoernager
Copy link
Contributor Author

@rustbot label +T-libs-api -T-libs

r? libs-api

@rustbot rustbot 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 Oct 25, 2024
@rustbot rustbot assigned Amanieu and unassigned cuviper Oct 25, 2024
@tgross35 tgross35 added the S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. label Oct 26, 2024
@bjoernager
Copy link
Contributor Author

@rustbot label -S-waiting-on-fcp

@rustbot rustbot removed the S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. label Nov 2, 2024
@bjoernager
Copy link
Contributor Author

FCP has completed now.

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.

Thanks!

@dtolnay
Copy link
Member

dtolnay commented Nov 2, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Nov 2, 2024

📌 Commit 764349f has been approved by dtolnay

It is now in the queue for this repository.

@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 Nov 2, 2024
@dtolnay dtolnay assigned dtolnay and unassigned Amanieu Nov 2, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 2, 2024
…, r=dtolnay

Stabilise `const_char_encode_utf16`.

Closes: rust-lang#130660

This PR stabilises the `const_char_encode_utf16` feature gate (i.e. support for `char::encode_utf16` in constant expressions).

~~Note that the linked tracking issue is as of this writing currently awaiting FCP until 2024-11-02.~~
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 2, 2024
…llaumeGomez

Rollup of 8 pull requests

Successful merges:

 - rust-lang#132153 (Stabilise `const_char_encode_utf16`.)
 - rust-lang#132419 (PassWrapper: adapt for llvm/llvm-project@b01e2a8b5620466c3b)
 - rust-lang#132437 (coverage: Regression test for inlining into an uninstrumented crate)
 - rust-lang#132458 (get rid of a whole bunch of unnecessary rustc_const_unstable attributes)
 - rust-lang#132520 (NFC add known bug nr to test)
 - rust-lang#132522 (make codegen help output more consistent)
 - rust-lang#132523 (Added regression test for generics index out of bounds)
 - rust-lang#132528 (Use `*_opt` typeck results fns to not ICE in fallback suggestion)

Failed merges:

 - rust-lang#132511 (stabilize const_arguments_as_str)

r? `@ghost`
`@rustbot` modify labels: rollup
@GuillaumeGomez
Copy link
Member

Failed in #132538.

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 2, 2024
Comment on lines 1824 to 1828
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
#[rustc_const_unstable(feature = "const_char_encode_utf16", issue = "130660")]
#[rustc_const_stable(feature = "const_char_encode_utf16", since = "CURRENT_RUSTC_VERSION")]
#[doc(hidden)]
#[inline]
#[rustc_allow_const_fn_unstable(const_eval_select)]
pub const fn encode_utf16_raw(mut code: u32, dst: &mut [u16]) -> &mut [u16] {
Copy link
Contributor

Choose a reason for hiding this comment

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

The way this works changed in #131349. I believe encode_utf16_raw needs to lose the rustc_const_{un}stable and rustc_allow_const_fn_unstable gates and instead get #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)].

You might also need to change the rustc_const_stable on encode_utf16 to #[cfg_attr(not(bootstrap), rustc_const_stable)] so it only becomes const stable when the new stability checking is available.

Cc @rust-lang/wg-const-eval, I'm not positive about the right thing to do while the new checks aren't in bootstrap.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

But yes, an unstable function cannot be rustc_const_stable in the new regime. But the trouble is this code needs to build both with the bootstrap compiler and the latest nightly compiler, so the result should be something like

#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_char_encode_utf16", since = "CURRENT_RUSTC_VERSION"))]
#[rustc_allow_const_fn_unstable(const_eval_select)]

Also please add a comment explaining why allowing const_eval_select is okay.

You might also need to change the rustc_const_stable on encode_utf16 to #[cfg_attr(not(bootstrap), rustc_const_stable)] so it only becomes const stable when the new stability checking is available.

That should not be needed.

@rustbot rustbot removed the has-merge-commits PR has merge commits, merge with caution. label Nov 4, 2024
@bjoernager

This comment was marked as outdated.

@bjoernager bjoernager reopened this Nov 4, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@dtolnay
Copy link
Member

dtolnay commented Nov 4, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Nov 4, 2024

📌 Commit 7faa84e has been approved by dtolnay

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 4, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 4, 2024
…, r=dtolnay

Stabilise `const_char_encode_utf16`.

Closes: rust-lang#130660

This PR stabilises the `const_char_encode_utf16` feature gate (i.e. support for `char::encode_utf16` in constant expressions).

~~Note that the linked tracking issue is as of this writing currently awaiting FCP until 2024-11-02.~~
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 4, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#132153 (Stabilise `const_char_encode_utf16`.)
 - rust-lang#132355 (Fix compiler panic with a large number of threads)
 - rust-lang#132486 (No need to instantiate binder in `confirm_async_closure_candidate`)
 - rust-lang#132594 (Subtree update of `rust-analyzer`)

r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Nov 4, 2024
…, r=dtolnay

Stabilise `const_char_encode_utf16`.

Closes: rust-lang#130660

This PR stabilises the `const_char_encode_utf16` feature gate (i.e. support for `char::encode_utf16` in constant expressions).

~~Note that the linked tracking issue is as of this writing currently awaiting FCP until 2024-11-02.~~
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 4, 2024
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#129884 (mark some target features as 'forbidden' so they cannot be (un)set with -Ctarget-feature)
 - rust-lang#132153 (Stabilise `const_char_encode_utf16`.)
 - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code)
 - rust-lang#132571 (add const_eval_select macro to reduce redundancy)
 - rust-lang#132587 (Revert "Avoid nested replacement ranges" from rust-lang#129346.)
 - rust-lang#132596 ([rustdoc] Fix `--show-coverage` when JSON output format is used)
 - rust-lang#132598 (Clippy: Move some attribute lints to be early pass (post expansion))
 - rust-lang#132601 (Update books)
 - rust-lang#132606 (Improve example of `impl Pattern for &[char]`)
 - rust-lang#132609 (docs: fix grammar in doc comment at unix/process.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
tgross35 added a commit to tgross35/rust that referenced this pull request Nov 5, 2024
…, r=dtolnay

Stabilise `const_char_encode_utf16`.

Closes: rust-lang#130660

This PR stabilises the `const_char_encode_utf16` feature gate (i.e. support for `char::encode_utf16` in constant expressions).

~~Note that the linked tracking issue is as of this writing currently awaiting FCP until 2024-11-02.~~
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#131153 (Improve duplicate derive Copy/Clone diagnostics)
 - rust-lang#131341 (Support clobber_abi and vector registers (clobber-only) in PowerPC inline assembly)
 - rust-lang#132025 (fix suggestion for diagnostic error E0027)
 - rust-lang#132153 (Stabilise `const_char_encode_utf16`.)
 - rust-lang#132303 (More tests for non-exhaustive C-like enums in FFI)
 - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code)
 - rust-lang#132598 (Clippy: Move some attribute lints to be early pass (post expansion))
 - rust-lang#132606 (Improve example of `impl Pattern for &[char]`)
 - rust-lang#132609 (docs: fix grammar in doc comment at unix/process.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2024
…kingjubilee

Rollup of 4 pull requests

Successful merges:

 - rust-lang#132153 (Stabilise `const_char_encode_utf16`.)
 - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code)
 - rust-lang#132600 (PassWrapper: adapt for new parameter in LLVM)
 - rust-lang#132630 (triagebot: ping wg-const-eval when relevant files change)

r? `@ghost`
`@rustbot` modify labels: rollup
@workingjubilee
Copy link
Member

workingjubilee commented Nov 5, 2024

Bizarrely high rate of merge conflicts.

@bors p=1

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2024
…kingjubilee

Rollup of 4 pull requests

Successful merges:

 - rust-lang#132153 (Stabilise `const_char_encode_utf16`.)
 - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code)
 - rust-lang#132600 (PassWrapper: adapt for new parameter in LLVM)
 - rust-lang#132630 (triagebot: ping wg-const-eval when relevant files change)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1ee6617 into rust-lang:master Nov 5, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 5, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2024
Rollup merge of rust-lang#132153 - bjoernager:const-char-encode-utf16, r=dtolnay

Stabilise `const_char_encode_utf16`.

Closes: rust-lang#130660

This PR stabilises the `const_char_encode_utf16` feature gate (i.e. support for `char::encode_utf16` in constant expressions).

~~Note that the linked tracking issue is as of this writing currently awaiting FCP until 2024-11-02.~~
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-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.

Tracking Issue for const_char_encode_utf16