diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-11-17 23:56:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-17 23:56:10 +0800 |
| commit | af1c8be4007b5c4e0d16e6b72cb5ee10db53d80c (patch) | |
| tree | 83967a0e10381cf457951edb484fb04b3eac34e5 /compiler/rustc_const_eval/src | |
| parent | ccc3f862d6cbd027f8fe1438666ff09451854c26 (diff) | |
| parent | 543627ddbe82516d0a0e4beea64234ddf1b7c33d (diff) | |
| download | rust-af1c8be4007b5c4e0d16e6b72cb5ee10db53d80c.tar.gz rust-af1c8be4007b5c4e0d16e6b72cb5ee10db53d80c.zip | |
Rollup merge of #133116 - RalfJung:const-null-ptr, r=dtolnay
stabilize const_ptr_is_null FCP passed in https://github.com/rust-lang/rust/issues/74939. The second commit cleans up const stability around UB checks a bit, now that everything they need (except for `const_eval_select`) is stable. Fixes https://github.com/rust-lang/rust/issues/74939
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. |
