-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Conversation
@rustbot label +T-libs-api -T-libs r? libs-api |
@rustbot label -S-waiting-on-fcp |
FCP has completed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@bors r+ |
…, 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.~~
…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
library/core/src/char/methods.rs
Outdated
#[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] { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope the docs at https://rustc-dev-guide.rust-lang.org/stability.html#rustc_const_unstable are helpful :)
There was a problem hiding this comment.
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.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
7561445
to
98ad987
Compare
This comment has been minimized.
This comment has been minimized.
98ad987
to
7faa84e
Compare
@bors r+ |
…, 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.~~
…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
…, 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.~~
…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
…, 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.~~
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
…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
Bizarrely high rate of merge conflicts. @bors p=1 |
…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
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.~~
Closes: #130660
This PR stabilises the
const_char_encode_utf16
feature gate (i.e. support forchar::encode_utf16
in constant expressions).Note that the linked tracking issue is as of this writing currently awaiting FCP until 2024-11-02.