about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/tcx.rs
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2023-06-03 00:41:50 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2023-06-19 01:47:03 -0700
commit39788e07bae91e9974ba6879a63e4e8b97503f5b (patch)
tree2b1d01608304f228b79e764cb41831c29dcfa604 /compiler/rustc_middle/src/mir/tcx.rs
parent8d1fa473dddd12efb2430302e5f5dfcc3eb73f8b (diff)
downloadrust-39788e07bae91e9974ba6879a63e4e8b97503f5b.tar.gz
rust-39788e07bae91e9974ba6879a63e4e8b97503f5b.zip
Promote unchecked_add/sub/mul/shl/shr to mir::BinOp
Diffstat (limited to 'compiler/rustc_middle/src/mir/tcx.rs')
-rw-r--r--compiler/rustc_middle/src/mir/tcx.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/mir/tcx.rs b/compiler/rustc_middle/src/mir/tcx.rs
index 5ca82413448..4a16abdd4e3 100644
--- a/compiler/rustc_middle/src/mir/tcx.rs
+++ b/compiler/rustc_middle/src/mir/tcx.rs
@@ -235,8 +235,11 @@ impl<'tcx> BinOp {
         // FIXME: handle SIMD correctly
         match self {
             &BinOp::Add
+            | &BinOp::AddUnchecked
             | &BinOp::Sub
+            | &BinOp::SubUnchecked
             | &BinOp::Mul
+            | &BinOp::MulUnchecked
             | &BinOp::Div
             | &BinOp::Rem
             | &BinOp::BitXor
@@ -246,7 +249,11 @@ impl<'tcx> BinOp {
                 assert_eq!(lhs_ty, rhs_ty);
                 lhs_ty
             }
-            &BinOp::Shl | &BinOp::Shr | &BinOp::Offset => {
+            &BinOp::Shl
+            | &BinOp::ShlUnchecked
+            | &BinOp::Shr
+            | &BinOp::ShrUnchecked
+            | &BinOp::Offset => {
                 lhs_ty // lhs_ty can be != rhs_ty
             }
             &BinOp::Eq | &BinOp::Lt | &BinOp::Le | &BinOp::Ne | &BinOp::Ge | &BinOp::Gt => {
@@ -293,7 +300,14 @@ impl BinOp {
             BinOp::Gt => hir::BinOpKind::Gt,
             BinOp::Le => hir::BinOpKind::Le,
             BinOp::Ge => hir::BinOpKind::Ge,
-            BinOp::Offset => unreachable!(),
+            BinOp::AddUnchecked
+            | BinOp::SubUnchecked
+            | BinOp::MulUnchecked
+            | BinOp::ShlUnchecked
+            | BinOp::ShrUnchecked
+            | BinOp::Offset => {
+                unreachable!()
+            }
         }
     }
 }