-
Notifications
You must be signed in to change notification settings - Fork 14k
std: Second pass stabilization for ptr
#20042
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
Conversation
|
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @aturon |
84e1ac0 to
3bdbde3
Compare
src/libcore/ptr.rs
Outdated
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.
Can you change this to say: Option is not clearly the right return type, and we may want to tie the return lifetime to a borrow of the raw pointer.
|
r=me modulo tiny nit |
3bdbde3 to
ad09584
Compare
|
deleting r+ for now, I'd like to take some more time to analyze https://github.com/Gankro/raw-rs/blob/master/src/rawptr.rs |
|
CC me |
ad09584 to
6ed5017
Compare
|
Ok, after thinking about this and talking it over with @gankro, I'm thinking the following:
For now the functionality stabilized here I believe is a subset of the possible future functionality, and I think we can let feedback during the first alpha cycle to drive the rest of what we stabilize in this module. Does that sound ok @gankro? re-r? @aturon |
6ed5017 to
105a2ae
Compare
src/libcore/ptr.rs
Outdated
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.
Can this be dropped in favor of !p.is_null()?
|
r=me modulo nits. |
|
Sounds okay, but the renames are a back-compat issue, no? |
Neither are being stabilized here, FWIW. |
|
Not sure if it matters, but they are compiler intrinsics. |
105a2ae to
e2f88b8
Compare
This commit performs a second pass for stabilization over the `std::ptr` module.
The specific actions taken were:
* The `RawPtr` trait was renamed to `PtrExt`
* The `RawMutPtr` trait was renamed to `MutPtrExt`
* The module name `ptr` is now stable.
* These functions were all marked `#[stable]` with no modification:
* `null`
* `null_mut`
* `swap`
* `replace`
* `read`
* `write`
* `PtrExt::is_null`
* `PtrExt::offset`
* These functions remain unstable:
* `as_ref`, `as_mut` - the return value of an `Option` is not fully expressive
as null isn't the only bad value, and it's unclear
whether we want to commit to these functions at this
time. The reference/lifetime semantics as written are
also problematic in how they encourage arbitrary
lifetimes.
* `zero_memory` - This function is currently not used at all in the
distribution, and in general it plays a broader role in the
"working with unsafe pointers" story. This story is not yet
fully developed, so at this time the function remains
unstable for now.
* `read_and_zero` - This function remains unstable for largely the same
reasons as `zero_memory`.
* These functions are now all deprecated:
* `PtrExt::null` - call `ptr::null` or `ptr::null_mut` instead.
* `PtrExt::to_uint` - use an `as` expression instead.
* `PtrExt::is_not_null` - use `!p.is_null()` instead.
e2f88b8 to
54452cd
Compare
This commit performs a second pass for stabilization over the `std::ptr` module.
The specific actions taken were:
* The `RawPtr` trait was renamed to `PtrExt`
* The `RawMutPtr` trait was renamed to `PtrMutExt`
* The module name `ptr` is now stable.
* These functions were all marked `#[stable]` with no modification:
* `null`
* `null_mut`
* `swap`
* `replace`
* `read`
* `write`
* `PtrExt::is_null`
* `PtrExt::is_not_null`
* `PtrExt::offset`
* These functions remain unstable:
* `as_ref`, `as_mut` - the return value of an `Option` is not fully expressive
as null isn't the only bad value, and it's unclear
whether we want to commit to these functions at this
time. The reference/lifetime semantics as written are
also problematic in how they encourage arbitrary
lifetimes.
* `zero_memory` - This function is currently not used at all in the
distribution, and in general it plays a broader role in the
"working with unsafe pointers" story. This story is not yet
fully developed, so at this time the function remains
unstable for now.
* `read_and_zero` - This function remains unstable for largely the same
reasons as `zero_memory`.
* These functions are now all deprecated:
* `PtrExt::null` - call `ptr::null` or `ptr::null_mut` instead.
* `PtrExt::to_uint` - use an `as` expression instead.
fix: Temporarily disable `+` typing handler as it moves the cursor position
fix: Temporarily disable `+` typing handler as it moves the cursor position
This commit performs a second pass for stabilization over the
std::ptrmodule.The specific actions taken were:
RawPtrtrait was renamed toPtrExtRawMutPtrtrait was renamed toPtrMutExtptris now stable.#[stable]with no modification:nullnull_mutswapreplacereadwritePtrExt::is_nullPtrExt::is_not_nullPtrExt::offsetas_ref,as_mut- the return value of anOptionis not fully expressiveas null isn't the only bad value, and it's unclear
whether we want to commit to these functions at this
time. The reference/lifetime semantics as written are
also problematic in how they encourage arbitrary
lifetimes.
zero_memory- This function is currently not used at all in thedistribution, and in general it plays a broader role in the
"working with unsafe pointers" story. This story is not yet
fully developed, so at this time the function remains
unstable for now.
read_and_zero- This function remains unstable for largely the samereasons as
zero_memory.PtrExt::null- callptr::nullorptr::null_mutinstead.PtrExt::to_uint- use anasexpression instead.