Skip to content

Commit f341db4

Browse files
committed
Conditionally lower contract checks
1 parent dc0bae1 commit f341db4

File tree

1 file changed

+3
-1
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+3
-1
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
11881188
// into:
11891189
//
11901190
// { contract_requires(PRECOND); let __postcond = |ret_val| POSTCOND; postcond({ body }) }
1191-
if let Some(contract) = contract {
1191+
if let Some(contract) = contract
1192+
&& this.tcx.sess.opts.unstable_opts.contract_checks == Some(true)
1193+
{
11921194
let precond = if let Some(req) = &contract.requires {
11931195
// Lower the precondition check intrinsic.
11941196
let lowered_req = this.lower_expr_mut(&req);

0 commit comments

Comments
 (0)