about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/statement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_middle/src/mir/statement.rs')
-rw-r--r--compiler/rustc_middle/src/mir/statement.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/statement.rs b/compiler/rustc_middle/src/mir/statement.rs
index f05a798949b..d59b6df44ed 100644
--- a/compiler/rustc_middle/src/mir/statement.rs
+++ b/compiler/rustc_middle/src/mir/statement.rs
@@ -774,6 +774,15 @@ impl BorrowKind {
     }
 }
 
+impl<'tcx> NullOp<'tcx> {
+    pub fn ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
+        match self {
+            NullOp::SizeOf | NullOp::AlignOf | NullOp::OffsetOf(_) => tcx.types.usize,
+            NullOp::UbChecks | NullOp::ContractChecks => tcx.types.bool,
+        }
+    }
+}
+
 impl<'tcx> UnOp {
     pub fn ty(&self, tcx: TyCtxt<'tcx>, arg_ty: Ty<'tcx>) -> Ty<'tcx> {
         match self {