]> git.lizzy.rs Git - rust.git/commit
Auto merge of #104977 - RalfJung:ptr-from-ref, r=dtolnay
authorbors <bors@rust-lang.org>
Sat, 24 Dec 2022 17:14:26 +0000 (17:14 +0000)
committerbors <bors@rust-lang.org>
Sat, 24 Dec 2022 17:14:26 +0000 (17:14 +0000)
commit7e4f4660ebb4533de629b5d7d8ac10ed572d0f2e
tree569d4852433db40daf93edd422fb69e65536874b
parentf5c3dfdbbf06d5997079ac7339de5002f7ced2a3
parent15f72dd29d083bfcade93ec2b57350c2b37feed6
Auto merge of #104977 - RalfJung:ptr-from-ref, r=dtolnay

add ptr::from_{ref,mut}

We have methods to avoid almost all `as` casts around raw pointer handling, except for the initial cast from reference to raw pointer. These new methods close that gap.

(I also moved `null_mut` next to `null` to keep the file consistently organized.)

r? libs-api

Tracking issue: https://github.com/rust-lang/rust/issues/106116
library/core/src/ptr/mod.rs