1
Fork 0

Add a new debug_assertions instrinsic (compiler)

And in clippy
This commit is contained in:
Ben Kimock 2024-02-07 10:26:00 -05:00
parent 55fabf35b1
commit 8836ac5758
18 changed files with 72 additions and 13 deletions

View file

@ -767,6 +767,15 @@ fn codegen_stmt<'tcx>(
NullOp::OffsetOf(fields) => {
layout.offset_of_subfield(fx, fields.iter()).bytes()
}
NullOp::DebugAssertions => {
let val = fx.tcx.sess.opts.debug_assertions;
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()),