Put checks that detect UB under their own flag below debug_assertions
This commit is contained in:
parent
83d0a940c6
commit
a7912cb421
42 changed files with 206 additions and 64 deletions
|
@ -16,7 +16,7 @@ impl<'tcx> MirPass<'tcx> for CheckAlignment {
|
|||
if sess.target.llvm_target == "i686-pc-windows-msvc" {
|
||||
return false;
|
||||
}
|
||||
sess.opts.debug_assertions
|
||||
sess.ub_checks()
|
||||
}
|
||||
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
|
|
|
@ -149,7 +149,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
|||
|
||||
fn simplify_ub_check(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
||||
if let Rvalue::NullaryOp(NullOp::UbChecks, _) = *rvalue {
|
||||
let const_ = Const::from_bool(self.tcx, self.tcx.sess.opts.debug_assertions);
|
||||
let const_ = Const::from_bool(self.tcx, self.tcx.sess.ub_checks());
|
||||
let constant = ConstOperand { span: source_info.span, const_, user_ty: None };
|
||||
*rvalue = Rvalue::Use(Operand::Constant(Box::new(constant)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue