Skip to content

Commit fa43703

Browse files
pnkfelixcelinval
authored andcommitted
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.
1 parent 84595c2 commit fa43703

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: src/base.rs

+9
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,15 @@ fn codegen_stmt<'tcx>(
874874
lval.write_cvalue(fx, val);
875875
return;
876876
}
877+
NullOp::ContractChecks => {
878+
let val = fx.tcx.sess.contract_checks();
879+
let val = CValue::by_val(
880+
fx.bcx.ins().iconst(types::I8, i64::try_from(val).unwrap()),
881+
fx.layout_of(fx.tcx.types.bool),
882+
);
883+
lval.write_cvalue(fx, val);
884+
return;
885+
}
877886
};
878887
let val = CValue::by_val(
879888
fx.bcx.ins().iconst(fx.pointer_type, i64::try_from(val).unwrap()),

0 commit comments

Comments
 (0)