1
Fork 0

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 46b180ec24
commit 5a93a59fd5
47 changed files with 415 additions and 263 deletions

View file

@ -685,7 +685,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let val = layout.offset_of_subfield(bx.cx(), fields.iter()).bytes();
bx.cx().const_usize(val)
}
mir::NullOp::DebugAssertions => {
mir::NullOp::UbCheck(_) => {
// In codegen, we want to check for language UB and library UB
let val = bx.tcx().sess.opts.debug_assertions;
bx.cx().const_bool(val)
}