diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-03-16 13:19:53 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-16 13:19:53 +0800 |
| commit | e714c3be9f8c459b1b81b212717e3693d2cb32df (patch) | |
| tree | dc55fdbe0e37e0e02409a3ee0e5ab12843d2f07e /compiler/rustc_middle/src | |
| parent | c29a29e71796137e7853a96dd3ff5fb181ee3c8e (diff) | |
| parent | 3d42541313c98e2570672a008117ed8f2fbd81e8 (diff) | |
| download | rust-e714c3be9f8c459b1b81b212717e3693d2cb32df.tar.gz rust-e714c3be9f8c459b1b81b212717e3693d2cb32df.zip | |
Rollup merge of #138549 - scottmcm:option-ssa, r=saethlin
Fix the OperandRef type for NullOp::{UbChecks,ContractChecks}
Stumbled on this while looking at something totally unrelated 🙃
r? saethlin
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/mir/statement.rs | 9 |
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 { |
