@@ -295,6 +295,72 @@ impl<T: ?Sized> *const T {
295295        intrinsics:: ptr_offset_from ( self ,  origin) 
296296    } 
297297
298+     /// Returns whether two pointers are guaranteed to be equal. 
299+ /// 
300+ /// At runtime this function behaves like `self == other`. 
301+ /// However, in some contexts (e.g., compile-time evaluation), 
302+ /// it is not always possible to determine equality of two pointers, so this function may 
303+ /// spuriously return `false` for pointers that later actually turn out to be equal. 
304+ /// But when it returns `true`, the pointers are guaranteed to be equal. 
305+ /// 
306+ /// This function is the mirror of [`guaranteed_ne`], but not its inverse. There are pointer 
307+ /// comparisons for which both functions return `false`. 
308+ /// 
309+ /// [`guaranteed_ne`]: #method.guaranteed_ne 
310+ /// 
311+ /// The return value may change depending on the compiler version and unsafe code may not 
312+ /// rely on the result of this function for soundness. It is suggested to only use this function 
313+ /// for performance optimizations where spurious `false` return values by this function do not 
314+ /// affect the outcome, but just the performance. 
315+ /// The consequences of using this method to make runtime and compile-time code behave 
316+ /// differently have not been explored. This method should not be used to introduce such 
317+ /// differences, and it should also not be stabilized before we have a better understanding 
318+ /// of this issue. 
319+ /// ``` 
320+ #[ unstable( feature = "const_raw_ptr_comparison" ,  issue = "53020" ) ]  
321+     #[ rustc_const_unstable( feature = "const_raw_ptr_comparison" ,  issue = "53020" ) ]  
322+     #[ inline]  
323+     #[ cfg( not( bootstrap) ) ]  
324+     pub  const  fn  guaranteed_eq ( self ,  other :  * const  T )  -> bool 
325+     where 
326+         T :  Sized , 
327+     { 
328+         intrinsics:: ptr_guaranteed_eq ( self ,  other) 
329+     } 
330+ 
331+     /// Returns whether two pointers are guaranteed to be inequal. 
332+ /// 
333+ /// At runtime this function behaves like `self != other`. 
334+ /// However, in some contexts (e.g., compile-time evaluation), 
335+ /// it is not always possible to determine the inequality of two pointers, so this function may 
336+ /// spuriously return `false` for pointers that later actually turn out to be inequal. 
337+ /// But when it returns `true`, the pointers are guaranteed to be inequal. 
338+ /// 
339+ /// This function is the mirror of [`guaranteed_eq`], but not its inverse. There are pointer 
340+ /// comparisons for which both functions return `false`. 
341+ /// 
342+ /// [`guaranteed_eq`]: #method.guaranteed_eq 
343+ /// 
344+ /// The return value may change depending on the compiler version and unsafe code may not 
345+ /// rely on the result of this function for soundness. It is suggested to only use this function 
346+ /// for performance optimizations where spurious `false` return values by this function do not 
347+ /// affect the outcome, but just the performance. 
348+ /// The consequences of using this method to make runtime and compile-time code behave 
349+ /// differently have not been explored. This method should not be used to introduce such 
350+ /// differences, and it should also not be stabilized before we have a better understanding 
351+ /// of this issue. 
352+ /// ``` 
353+ #[ unstable( feature = "const_raw_ptr_comparison" ,  issue = "53020" ) ]  
354+     #[ rustc_const_unstable( feature = "const_raw_ptr_comparison" ,  issue = "53020" ) ]  
355+     #[ inline]  
356+     #[ cfg( not( bootstrap) ) ]  
357+     pub  const  fn  guaranteed_ne ( self ,  other :  * const  T )  -> bool 
358+     where 
359+         T :  Sized , 
360+     { 
361+         intrinsics:: ptr_guaranteed_ne ( self ,  other) 
362+     } 
363+ 
298364    /// Calculates the distance between two pointers. The returned value is in 
299365/// units of T: the distance in bytes is divided by `mem::size_of::<T>()`. 
300366/// 
0 commit comments