diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2024-12-02 20:35:13 +0000 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2025-02-03 12:53:57 -0800 |
| commit | bcb8565f301b579dee60fffe87d5a329cc69fefa (patch) | |
| tree | eb7f0ec9b3ee08283342608c5bbe0eb316834f54 /compiler/rustc_codegen_cranelift/src/base.rs | |
| parent | 534d79adf938fc3839fad47832c7cf2b4927d7d9 (diff) | |
| download | rust-bcb8565f301b579dee60fffe87d5a329cc69fefa.tar.gz rust-bcb8565f301b579dee60fffe87d5a329cc69fefa.zip | |
Contracts core intrinsics.
These are hooks to: 1. control whether contract checks are run 2. allow 3rd party tools to intercept and reintepret the results of running contracts.
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/base.rs')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/base.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index 7a40d236b92..de2ce1768fa 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -874,6 +874,15 @@ fn codegen_stmt<'tcx>( lval.write_cvalue(fx, val); return; } + NullOp::ContractChecks => { + let val = fx.tcx.sess.contract_checks(); + let val = CValue::by_val( + fx.bcx.ins().iconst(types::I8, i64::try_from(val).unwrap()), + fx.layout_of(fx.tcx.types.bool), + ); + lval.write_cvalue(fx, val); + return; + } }; let val = CValue::by_val( fx.bcx.ins().iconst(fx.pointer_type, i64::try_from(val).unwrap()), |
