@@ -2434,20 +2434,29 @@ extern "rust-intrinsic" {
2434
2434
#[ rustc_nounwind]
2435
2435
pub fn ptr_offset_from_unsigned < T > ( ptr : * const T , base : * const T ) -> usize ;
2436
2436
2437
- /// See documentation of `<*const T>::guaranteed_eq` for details.
2438
- /// Returns `2` if the result is unknown.
2439
- /// Returns `1` if the pointers are guaranteed equal
2440
- /// Returns `0` if the pointers are guaranteed inequal
2441
- ///
2442
- /// Note that, unlike most intrinsics, this is safe to call;
2443
- /// it does not require an `unsafe` block.
2444
- /// Therefore, implementations must not require the user to uphold
2445
- /// any safety invariants.
2446
2437
#[ rustc_const_unstable( feature = "const_raw_ptr_comparison" , issue = "53020" ) ]
2447
2438
#[ rustc_safe_intrinsic]
2448
2439
#[ rustc_nounwind]
2440
+ #[ cfg( bootstrap) ]
2449
2441
pub fn ptr_guaranteed_cmp < T > ( ptr : * const T , other : * const T ) -> u8 ;
2442
+ }
2450
2443
2444
+ /// See documentation of `<*const T>::guaranteed_eq` for details.
2445
+ /// Returns `2` if the result is unknown.
2446
+ /// Returns `1` if the pointers are guaranteed equal
2447
+ /// Returns `0` if the pointers are guaranteed inequal
2448
+ #[ rustc_const_unstable( feature = "const_raw_ptr_comparison" , issue = "53020" ) ]
2449
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2450
+ #[ rustc_intrinsic]
2451
+ #[ cfg( not( bootstrap) ) ]
2452
+ #[ rustc_nounwind]
2453
+ #[ rustc_do_not_const_check]
2454
+ #[ inline]
2455
+ pub const fn ptr_guaranteed_cmp < T > ( ptr : * const T , other : * const T ) -> u8 {
2456
+ ( ptr == other) as u8
2457
+ }
2458
+
2459
+ extern "rust-intrinsic" {
2451
2460
/// Determines whether the raw bytes of the two values are equal.
2452
2461
///
2453
2462
/// This is particularly handy for arrays, since it allows things like just
0 commit comments