mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-03 01:16:14 +03:00
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.
This commit is contained in:
committed by
Celina G. Val
parent
84595c2b1e
commit
fa43703573
@@ -874,6 +874,15 @@ fn is_wide_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
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()),
|
||||
|
||||
Reference in New Issue
Block a user