]> git.lizzy.rs Git - rust.git/commitdiff
Respect sess.overflow_checks()
authorbjorn3 <bjorn3@users.noreply.github.com>
Sat, 20 Jul 2019 15:05:43 +0000 (17:05 +0200)
committerbjorn3 <bjorn3@users.noreply.github.com>
Fri, 26 Jul 2019 09:29:35 +0000 (11:29 +0200)
src/base.rs

index 8821a629519e98a37bfbd6fccf491e138754f31b..7f99f4ad4f71d7bb72cb46e7a2b5ddaa17f4ef88 100644 (file)
@@ -874,6 +874,10 @@ pub fn trans_checked_int_binop<'a, 'tcx: 'a>(
     out_ty: Ty<'tcx>,
     signed: bool,
 ) -> CValue<'tcx> {
+    if !fx.tcx.sess.overflow_checks() {
+        return trans_int_binop(fx, bin_op, in_lhs, in_rhs, out_ty, signed);
+    }
+
     if bin_op != BinOp::Shl && bin_op != BinOp::Shr {
         assert_eq!(
             in_lhs.layout().ty,