-
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
Stabilize ptr::{from_ref, from_mut}
#117824
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Given that one can already |
1dc3ea8
to
363b660
Compare
This comment has been minimized.
This comment has been minimized.
363b660
to
bee93c4
Compare
r? dtolnay |
@rust-lang/libs-api: Notes from the tracking issue: #106116 (comment) is worth considering: currently you can take a use core::ptr;
fn main() {
let m: &mut i32 = &mut 0;
let p1: *const i32 = ptr::from_ref(m);
let p2: *const i32 = ptr::from_mut(m);
} #106116 (comment) regarding |
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
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!
bee93c4
to
b863e9b
Compare
|
@bors r+ |
…dtolnay Stabilize `ptr::{from_ref, from_mut}` I propose to stabilize the following APIs: ```rust // mod core::ptr pub const fn from_ref<T: ?Sized>(r: &T) -> *const T; pub const fn from_mut<T: ?Sized>(r: &mut T) -> *mut T; ``` Tracking issue: rust-lang#106116 --- `@RalfJung` what do you think we should do with `from_mut`? Stabilize it as const, given that you can't call it anyway (no way to get `&mut` in `const fn`)? Defer stabilizing it as const leaving the same issue/feature? Change issue/feature? Change issue/feature to the "`&mut` in const fn" one?
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#117824 (Stabilize `ptr::{from_ref, from_mut}`) - rust-lang#118234 (Stabilize `type_name_of_val`) - rust-lang#118944 (Move type relations into submodule `relate` in rustc_infer, and notify when it has changed) - rust-lang#118977 (Simplify `src-script.js` code) - rust-lang#118985 (Remove `@JohnTitor` from diagnostics pings) - rust-lang#118986 (Simplify JS code a little bit) - rust-lang#118988 (rustdoc: add regression test for JS data file loading) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#117824 - WaffleLapkin:ptr_from_ref_stab, r=dtolnay Stabilize `ptr::{from_ref, from_mut}` I propose to stabilize the following APIs: ```rust // mod core::ptr pub const fn from_ref<T: ?Sized>(r: &T) -> *const T; pub const fn from_mut<T: ?Sized>(r: &mut T) -> *mut T; ``` Tracking issue: rust-lang#106116 --- ``@RalfJung`` what do you think we should do with `from_mut`? Stabilize it as const, given that you can't call it anyway (no way to get `&mut` in `const fn`)? Defer stabilizing it as const leaving the same issue/feature? Change issue/feature? Change issue/feature to the "`&mut` in const fn" one?
I propose to stabilize the following APIs:
Tracking issue: #106116
@RalfJung what do you think we should do with
from_mut
? Stabilize it as const, given that you can't call it anyway (no way to get&mut
inconst fn
)? Defer stabilizing it as const leaving the same issue/feature? Change issue/feature? Change issue/feature to the "&mut
in const fn" one?