Skip to content

Commit

Permalink
Rollup merge of #97764 - RalfJung:strict, r=dtolnay
Browse files Browse the repository at this point in the history
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. :)
  • Loading branch information
matthiaskrgr committed Jun 5, 2022
2 parents 92271ca + 4a41c35 commit d8d7de0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ pub const fn null<T>() -> *const T {
#[rustc_diagnostic_item = "ptr_null"]
#[cfg(not(bootstrap))]
pub const fn null<T: ?Sized + Thin>() -> *const T {
from_raw_parts(0 as *const (), ())
from_raw_parts(invalid(0), ())
}

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

/// Forms a raw slice from a pointer and a length.
Expand Down

0 comments on commit d8d7de0

Please sign in to comment.