Distinguish between library and lang UB in assert_unsafe_precondition

This commit is contained in:
Ben Kimock 2024-02-26 21:25:27 -05:00
parent 5ffd498ca1
commit 127c232050

View File

@ -779,7 +779,7 @@ fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
NullOp::OffsetOf(fields) => { NullOp::OffsetOf(fields) => {
layout.offset_of_subfield(fx, fields.iter()).bytes() layout.offset_of_subfield(fx, fields.iter()).bytes()
} }
NullOp::DebugAssertions => { NullOp::UbCheck(_) => {
let val = fx.tcx.sess.opts.debug_assertions; let val = fx.tcx.sess.opts.debug_assertions;
let val = CValue::by_val( let val = CValue::by_val(
fx.bcx.ins().iconst(types::I8, i64::try_from(val).unwrap()), fx.bcx.ins().iconst(types::I8, i64::try_from(val).unwrap()),