-
Notifications
You must be signed in to change notification settings - Fork 14k
Stabilize maybe_uninit_write_slice
#148048
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
base: main
Are you sure you want to change the base?
Stabilize maybe_uninit_write_slice
#148048
Conversation
|
Note that this feature is one day into the FCP, so this is almost, but not quite, ready to merge. |
This comment has been minimized.
This comment has been minimized.
8780eda to
5088b38
Compare
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 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))] |
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.
Is this actually required? I thought we stopped needing most of these after the latest bootstrap reworks…
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.
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());
| ^^^^^^^^^^^^^^^^^^^
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.
Hmm, that's extra strange considering the weird relative library path, but it is what it is. Thanks for verifying.
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.
@jieyouxu Is this behavior expected?
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.
Yes, proc-macros can be one of those special cases, because see
rust/compiler/rustc_proc_macro/Cargo.toml
Lines 1 to 5 in 6e41e61
| # 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.
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.