diff options
| author | Ralf Jung <post@ralfj.de> | 2024-11-16 18:32:25 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-11-16 22:50:22 +0100 |
| commit | 5eef5ee38abbccac368871bef0555fc24b2c53f3 (patch) | |
| tree | f9853f91fb819c889b0829109c950732f283ce75 /compiler/rustc_const_eval/src | |
| parent | 46e8d20301cb4abe91ab0a4bea43bb085e1d4e4a (diff) | |
| download | rust-5eef5ee38abbccac368871bef0555fc24b2c53f3.tar.gz rust-5eef5ee38abbccac368871bef0555fc24b2c53f3.zip | |
stabilize const_ptr_is_null
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/machine.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 62115aef4a7..f12320cb851 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -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. |
