-
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
Implemented const casts of raw pointers #92657
Conversation
Updates src/tools/cargo. cc @ehuss Some changes occured to the Miri submodule cc @rust-lang/miri |
r? @scottmcm (rust-highfive has picked a reviewer for you, use r? to override) |
|
c110f3e
to
8b5c8fd
Compare
Sorry for the noise accidentally adding submodules, fixed it. r? @RalfJung I think you're the right person to review? |
This comment has been minimized.
This comment has been minimized.
8b5c8fd
to
a25df05
Compare
It's a bit unfortunate that |
Hm, no, not really... this is @rust-lang/libs-api territory. |
This looks good to me. Can you open a tracking issue? Thanks! |
Let's make sure we track this in the tracking issue and answer that question before stabilizing. |
This adds `as_mut()` method for `*const T` and `as_const()` for `*mut T` which are intended to make casting of consts safer. This was discussed in the [internals discussion][discussion]. [discussion]: https://internals.rust-lang.org/t/casting-constness-can-be-risky-heres-a-simple-fix/15933
a25df05
to
1a96623
Compare
Done. Was confused about that question at first so I reworded it to hopefully avoid confusion of others. Also filled the issue number in the PR. |
@bors r+ |
📌 Commit 1a96623 has been approved by |
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#92055 (Add release notes for 1.58) - rust-lang#92490 (Move crate drop-down to search results page) - rust-lang#92510 (Don't resolve blocks in foreign functions) - rust-lang#92573 (expand: Refactor InvocationCollector visitor for better code reuse) - rust-lang#92608 (rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes) - rust-lang#92657 (Implemented const casts of raw pointers) - rust-lang#92671 (Make `Atomic*::from_mut` return `&mut Atomic*`) - rust-lang#92673 (Remove useless collapse toggle on "all items" page) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This adds
as_mut()
method for*const T
andas_const()
for*mut T
which are intended to make casting of consts safer. This was discussed
in the internals discussion.
Given that this is a simple change and multiple people agreed to it including @RalfJung I decided to go ahead and open the PR.