-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Add a conversion from &mut T
to &mut UnsafeCell<T>
#107917
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon. Please see the contribution instructions for more information. |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
@rustbot label +T-libs-api -T-libs |
@rustbot label -T-libs-api +T-libs |
This comment has been minimized.
This comment has been minimized.
This is a libs-api change:
You'll also need to make an ACP and mark this as |
I see, thank you. @rustbot label +T-libs-api +S-waiting-on-ACP -T-libs |
I'm not sure if that should return It's worth noting that we already guarantee converting from fn get_shared<T>(ptr: &mut T) -> &UnsafeCell<T> {
let t = ptr as *mut T as *const UnsafeCell<T>;
// SAFETY: `T` and `UnsafeCell<T>` have the same memory layout
unsafe { &*t }
} |
This comment has been minimized.
This comment has been minimized.
Note that |
I think it was probably a mistake for |
@JoJoJet Just want to ping you as part of the triage procedure to let you know that CI fails for this PR :) |
@anden3 Yes, thank you. Like I said, I'll need a bit of guidance, as I haven't contributed to this repo before :). I believe that I need to add a feature flag for this and gate the new function behind it, but I wasn't able to locate the guidelines for this type of thing. |
Would this help? |
Yes that helps, thank you. |
This comment has been minimized.
This comment has been minimized.
@JoJoJet this needs an ACP, have you created one already for it? If so can you post it here or preferably add it to the title of the pr? thanks |
The ACP is at rust-lang/libs-team#198. What do you want me to add to the title? |
The ACP link but that's fine i'll do it :P |
@rustbot label -S-waiting-on-author |
Please add a tracking issue for this. Once that's done, r=me (you can write @bors delegate+ |
✌️ @JoJoJet can now approve this pull request |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
compiler/rustc_feature/src/active.rs
Outdated
@@ -533,6 +533,8 @@ declare_features! ( | |||
(active, type_changing_struct_update, "1.58.0", Some(86555), None), | |||
/// Enables rustc to generate code that instructs libstd to NOT ignore SIGPIPE. | |||
(active, unix_sigpipe, "1.65.0", Some(97889), None), | |||
/// Allows a safe conversion from `&mut T` to `&mut UnsafeCell<T>`. | |||
(incomplete, unsafe_cell_from_mut, "1.70.0", Some(111645), None), |
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.
This isn't necessary for library features, the feature name will picked up from the #[unstable]
attribute directly.
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 see, thank you.
@bors r=joshtriplett |
📌 Commit 810a87bb92347101cf6230d944993a19983544cb has been approved by It is now in the queue for this repository. |
0de00d1 https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy. 10 commits for 22 lines == squash commits. |
810a87b
to
767b6b2
Compare
Some changes occurred in src/tools/cargo cc @ehuss |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Provides a safe way of downgrading an exclusive reference into an alias-able
&UnsafeCell<T>
reference.I would appreciate guidance on what exactly I should put for the stability attribute.
ACP: rust-lang/libs-team#198.