Conversation
|
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
|
I'm unsure about |
|
@jfager I would expect that |
|
@WaffleLapkin looks like you tagged the wrong person! |
|
Oops, right. I've meant to tag @jfrimmel 😅 |
|
The The But I'm not sure about the |
|
@m-ou-se my original motivation for
Then maybe instead of Not sure which way is better. |
|
@WaffleLapkin Ping from triage, what's next steps here? |
Yeah maybe. I'd still put that in cc @rust-lang/libs-api Any thoughts on these functions? |
|
I don't see why the safety requirement of get_unchecked involves utf8 boundaries. I would expect only the same safety requirements as https://doc.rust-lang.org/std/primitive.pointer.html#method.add. Please document safety requirements in a Can we have safe indexing that works like https://doc.rust-lang.org/std/primitive.pointer.html#method.wrapping_add ? |
Hm. So |
|
So, to summarize the state of this PR.
I'm waiting for the decision on |
|
☔ The latest upstream changes (presumably #85769) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Triage: Still has conflicts |
3a74406 to
7425507
Compare
|
☔ The latest upstream changes (presumably #86808) made this pull request unmergeable. Please resolve the merge conflicts. |
7425507 to
55646f0
Compare
|
☔ The latest upstream changes (presumably #87875) made this pull request unmergeable. Please resolve the merge conflicts. |
The functions are under feature gate `str_from_raw_parts` and are similar to `slice_from_raw_parts`, `slice_from_raw_parts_mut`.
55646f0 to
4c8427c
Compare
This comment has been minimized.
This comment has been minimized.
These items allow to make inherent impls for `*const str` and `*mut str`.
This patch adds the following methods to `*const str` and `*mut str`: - `len` - `as_ptr` (`as_mut_ptr`) - `get_unchecked` (`get_unchecked_mut`) Similar methods have already existed for raw slices.
This patch adds the following methods to `NonNull<str>`: - `str_from_raw_parts` - `len` - `as_non_null_ptr` - `as_mut_ptr` - `get_unchecked_mut` Similar methods have already existed for raw slices, raw strings and nonnull raw strings.
4c8427c to
3ebb712
Compare
|
☔ The latest upstream changes (presumably #91203) made this pull request unmergeable. Please resolve the merge conflicts. |
This PR adds the following functions for pointers to
str, similar to already existing functions for pointers to[T].I wasn't sure about feature gates and how to group them, so the advice is very appreciated.
This PR also adds
const_str_ptrandmut_str_ptrlang items (they are required for*const strand*mut strimpls).See also:
lenfor raw slices -- Tracking Issue for raw slice len() method (slice_ptr_len, const_slice_ptr_len) #71146as{,_mut,_non_null}_ptr,get_unchecked[_mut]-- Tracking Issue for raw slice getters (slice_ptr_get) #74265ptr::slice_from_raw_parts[_mut]-- Tracking issue forptr::slice_from_raw_parts[_mut]#36925