Skip to content

Conversation

@thaliaarchi
Copy link
Contributor

@thaliaarchi thaliaarchi commented Oct 23, 2025

Stabilize feature maybe_uninit_write_slice (tracked in #79995).

Note that this also const-stabilizes <[MaybeUninit<_>]>::write_copy_of_slice. That method depends on <[_]>::copy_from_slice, which is already const-stable, and the unstable <[MaybeUninit<_>]>::assume_init_mut, which is just casts.

@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 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 23, 2025

r? @scottmcm

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

@thaliaarchi
Copy link
Contributor Author

Note that this feature is one day into the FCP, so this is almost, but not quite, ready to merge.

@rust-log-analyzer

This comment has been minimized.

@thaliaarchi thaliaarchi force-pushed the stabilize-maybeuninit-write-slice branch from 8780eda to 5088b38 Compare October 23, 2025 20:03
Copy link
Member

@hkBst hkBst left a comment

Choose a reason for hiding this comment

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

@thaliaarchi
Copy link
Contributor Author

The FCP passed, so I believe this is now ready to merge

#![feature(allow_internal_unstable)]
#![feature(decl_macro)]
#![feature(maybe_uninit_write_slice)]
#![cfg_attr(bootstrap, feature(maybe_uninit_write_slice))]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually required? I thought we stopped needing most of these after the latest bootstrap reworks…

Copy link
Contributor Author

@thaliaarchi thaliaarchi Nov 5, 2025

Choose a reason for hiding this comment

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

It appears necessary. With that line removed:

error[E0658]: use of unstable library feature `maybe_uninit_write_slice`
   --> compiler/rustc_proc_macro/../../library/proc_macro/src/bridge/arena.rs:105:27
    |
105 |         let bytes = alloc.write_copy_of_slice(string.as_bytes());
    |                           ^^^^^^^^^^^^^^^^^^^

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, that's extra strange considering the weird relative library path, but it is what it is. Thanks for verifying.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jieyouxu Is this behavior expected?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, proc-macros can be one of those special cases, because see

# We need to use a separate crate including library/proc_macro as opposed to a
# direct path dependency on library/proc_macro because doing the latter will
# cause two copies of libproc_macro.rlib to end up in the sysroot, breaking
# proc-macro crates. In addition it confuses the workspace_members function of
# bootstrap.

So I believe library/proc_macro can still need cfg-bootstrap bits, but other parts of library should (generally) not need it anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants