about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/transform/validate.rs
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2023-03-05 20:19:41 -0800
committerScott McMurray <scottmcm@users.noreply.github.com>2024-03-23 23:23:41 -0700
commit3da115a93b782796e3d267266b4241e5258f1fef (patch)
treed96ec402b98579b285d21945727fcb35eb51a6f8 /compiler/rustc_const_eval/src/transform/validate.rs
parent744c664ba2e6440024457d5ec0d3600b3e0c0144 (diff)
downloadrust-3da115a93b782796e3d267266b4241e5258f1fef.tar.gz
rust-3da115a93b782796e3d267266b4241e5258f1fef.zip
Add+Use `mir::BinOp::Cmp`
Diffstat (limited to 'compiler/rustc_const_eval/src/transform/validate.rs')
-rw-r--r--compiler/rustc_const_eval/src/transform/validate.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs
index 1664475f52a..6cde2296459 100644
--- a/compiler/rustc_const_eval/src/transform/validate.rs
+++ b/compiler/rustc_const_eval/src/transform/validate.rs
@@ -987,6 +987,15 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
                             )
                         }
                     }
+                    Cmp => {
+                        for x in [a, b] {
+                            check_kinds!(
+                                x,
+                                "Cannot three-way compare non-integer type {:?}",
+                                ty::Char | ty::Uint(..) | ty::Int(..)
+                            )
+                        }
+                    }
                     AddUnchecked | SubUnchecked | MulUnchecked | Shl | ShlUnchecked | Shr
                     | ShrUnchecked => {
                         for x in [a, b] {