Skip to content

Commit 1bf1932

Browse files
authored
Rollup merge of rust-lang#97764 - RalfJung:strict, r=dtolnay
use strict provenance APIs The stdlib was adjusted to avoid bare int2ptr casts, but recently some casts of that sort have sneaked back in. Let's fix that. :)
2 parents 554674b + 4a41c35 commit 1bf1932

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/ptr/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ pub const fn null<T>() -> *const T {
532532
#[rustc_diagnostic_item = "ptr_null"]
533533
#[cfg(not(bootstrap))]
534534
pub const fn null<T: ?Sized + Thin>() -> *const T {
535-
from_raw_parts(0 as *const (), ())
535+
from_raw_parts(invalid(0), ())
536536
}
537537

538538
/// Creates a null mutable raw pointer.
@@ -709,7 +709,7 @@ where
709709
#[rustc_diagnostic_item = "ptr_null_mut"]
710710
#[cfg(not(bootstrap))]
711711
pub const fn null_mut<T: ?Sized + Thin>() -> *mut T {
712-
from_raw_parts_mut(0 as *mut (), ())
712+
from_raw_parts_mut(invalid_mut(0), ())
713713
}
714714

715715
/// Forms a raw slice from a pointer and a length.

0 commit comments

Comments
 (0)