1
Fork 0

stabilize const_ptr_is_null

This commit is contained in:
Ralf Jung 2024-11-16 18:32:25 +01:00
parent 46e8d20301
commit 5eef5ee38a
9 changed files with 18 additions and 13 deletions

View file

@ -263,6 +263,12 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
}
/// See documentation on the `ptr_guaranteed_cmp` intrinsic.
/// Returns `2` if the result is unknown.
/// Returns `1` if the pointers are guaranteed equal.
/// Returns `0` if the pointers are guaranteed inequal.
///
/// Note that this intrinsic is exposed on stable for comparison with null. In other words, any
/// change to this function that affects comparison with null is insta-stable!
fn guaranteed_cmp(&mut self, a: Scalar, b: Scalar) -> InterpResult<'tcx, u8> {
interp_ok(match (a, b) {
// Comparisons between integers are always known.