Uh oh!
There was an error while loading. Please reload this page.
Stabilize ptr::slice_from_raw_parts[_mut] - #68234
Conversation
Hm right let's inform the bots about the review assignee properly I confused it by asking for a group 😅 So I just picked who GitHub recommended r? @oli-obk |
rust-highfive
commented
Jan 14, 2020
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Actual error: Click to expand the log.cc @TimNN: error fragments did not include error message (rebased) |
946656d to
5685650Comparerust-highfive
commented
Jan 14, 2020
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
5a36e2f to
b8cd7edComparerust-highfive
commented
Jan 15, 2020
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
b8cd7ed to
f76177cCompareSimonSapin
commented
Jan 15, 2020
This is two free functions in the pubconstfnslice_from_raw_parts<T>(data:*constT,len:usize) -> *const[T]{…}pubconstfnslice_from_raw_parts_mut<T>(data:*mutT,len:usize) -> *mut[T]{…}@rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
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. |
@rfcbot concern &raw I feel that the usefulness of this feature is tied with that of |
CAD97
commented
Jan 15, 2020
@Amanieu the reason I want these methods actually has nothing to do with The problem I'm dealing with is pointer provinence. I don't know (in my current generic API setup) whether the raw pointer I'm working with is from a If I use If I use And this is ignoring the case of potentially misaligned or null pointers, which are instant UB to use with the reference functions. Ultimately, I think there are enough reasons to have these functions, even if they aren't strictly required by the memory model (for aligned non-null pointers), because they're a simple helper API when you're working with pointers to begin with that sidestep all of the thorny questions around references in pointer workloads that will remain no matter the specific memory model. TL;DR: these functions are mainly useful when you don't know provenance (dependent on memory model), alignment, or null (definitely UB today). |
Amanieu
commented
Jan 15, 2020
I'm convinced! @rfcbot resolve &raw |
rfcbot
commented
Jan 15, 2020
🔔 This is now entering its final comment period, as per the review above. 🔔 |
CAD97
commented
Jan 15, 2020
I'm just going to go ahead and cc @rust-lang/wg-unsafe-code-guidelines just in case. This is an FCP-merge with some implication on unsafe guidelines. |
nikomatsakis
commented
Jan 15, 2020
For the record I think this stabilization makes sense. It doesn't seem to have many deep implications to me -- it is simply saying that one can construct a slice given a |
RalfJung
commented
Jan 15, 2020
It still has some uses though -- you still need the raw methods for potentially dangling or out-of-bounds or NULL or unaligned pointers. That seems like a good enough motivation to me. |
Uh oh!
There was an error while loading. Please reload this page.
rfcbot
commented
Jan 25, 2020
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. The RFC will be merged soon. |
KodrAus
commented
Jan 27, 2020
@bors r+ |
bors
commented
Jan 27, 2020
📌 Commit 1c0d485 has been approved by |
bors
commented
Jan 28, 2020
Stabilize ptr::slice_from_raw_parts[_mut] Closes#36925, the tracking issue. Initial impl: #60667 r? @rust-lang/libs In addition to stabilizing, I've adjusted the example of `ptr::slice_from_raw_parts` to use `slice_from_raw_parts` instead of `slice_from_raw_parts_mut`, which was unnecessary for the example as written.
bors
commented
Jan 28, 2020
☀️ Test successful - checks-azure |
Closes#36925, the tracking issue.
Initial impl: #60667
r? @rust-lang/libs
In addition to stabilizing, I've adjusted the example of
ptr::slice_from_raw_partsto useslice_from_raw_partsinstead ofslice_from_raw_parts_mut, which was unnecessary for the example as written.