Change:
Tracking issue for
FWIW this should be a relatively easy bug to knock out! The option is and we'd just want to add a new flag to the (we'll delete the flag once everyone's migrated). There's a few uses throughout the codebase which I believe will need an update:    After that we'd just need to add a test which validates this behavior, likely a addition with a annotation at the top. Likewise the Cargo support should be relatively easy:
I'd like to tackle this!
OK, so this is pretty straightforward. Couple questions after actually implementing this: The RFC says the option is , but comments on the RFC suggest that people expect this to be , so one could have (I guess) . Which variant should be supported? It seems better to make the value in the single source of truth to be used throughout the compiler by setting it based on the value of or ; this makes the uses easier to read and also makes any future removal of straightforward. How should interact with ? Should we just consider any explicit setting of to "win" and only consult if the option was not explicitly provided? I guess that would mean that we'd almost have to implement the variant above?
I think it's fine to just reuse the existing  which accepts a "standard variety" of boolean options. Makes sense to me to have a single source of truth! Right now I don't think we have a lot of precedent for modifying after creation so this may not be easy. Perhaps a helper method on though? That's what a . Yeah let's just have trump . The precise semantics likely don't matter too much anyway as we'll quickly phase out the version anyway.

Discussion:
"save all temporary output files during compilation"), rpath: bool = (false, parse_bool, [UNTRACKED], "set rpath values in libs/exes"), <ins> overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], "use overflow checks for integer arithmetic"), </ins> no_prepopulate_passes: bool = (false, parse_bool, [TRACKED], "don't pre-populate the pass manager with a list of passes"), no_vectorize_loops: bool = (false, parse_bool, [TRACKED],

assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); <ins> opts.cg.overflow_checks = Some(true); assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); </ins> opts.cg.no_prepopulate_passes = true; assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

pub fn nonzeroing_move_hints(&self) -> bool { self.opts.debugging_opts.enable_nonzeroing_move_hints } <ins> pub fn overflow_checks(&self) -> bool { self.opts.cg.overflow_checks .or(self.opts.debugging_opts.force_overflow_checks) .unwrap_or(self.opts.debug_assertions) } </ins> pub fn must_not_eliminate_frame_pointers(&self) -> bool { self.opts.debuginfo != DebugInfoLevel::NoDebugInfo ||

hash_spans: bool, hash_bodies: bool) -> Self { <del> let check_overflow = tcx.sess.opts.debugging_opts.force_overflow_checks .unwrap_or(tcx.sess.opts.debug_assertions); </del> <ins> let check_overflow = tcx.sess.overflow_checks(); </ins> StrictVersionHashVisitor { st: st,

let mut check_overflow = attrs.iter() .any(|item| item.check_name("rustc_inherit_overflow_checks")); <del> // Respect -Z force-overflow-checks=on and -C debug-assertions. check_overflow |= infcx.tcx .sess .opts .debugging_opts .force_overflow_checks .unwrap_or(infcx.tcx.sess.opts.debug_assertions); </del> <ins> // Respect -C overflow-checks. check_overflow |= infcx.tcx.sess.overflow_checks(); </ins> // Constants and const fn's always need overflow checks. check_overflow |= constness == hir::Constness::Const;

let ty::CrateAnalysis { export_map, reachable, name, .. } = analysis; let exported_symbols = find_exported_symbols(tcx, reachable); <del> let check_overflow = if let Some(v) = tcx.sess.opts.debugging_opts.force_overflow_checks { v } else { tcx.sess.opts.debug_assertions }; </del> <ins> let check_overflow = tcx.sess.overflow_checks(); </ins> let link_meta = link::build_link_meta(incremental_hashes_map, &name);

<ins> // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // compile-flags: -C overflow-checks use std::panic; fn main() { let r = panic::catch_unwind(|| { [1, i32::max_value()].iter().sum::<i32>(); }); assert!(r.is_err()); let r = panic::catch_unwind(|| { [2, i32::max_value()].iter().product::<i32>(); }); assert!(r.is_err()); let r = panic::catch_unwind(|| { [1, i32::max_value()].iter().cloned().sum::<i32>(); }); assert!(r.is_err()); let r = panic::catch_unwind(|| { [2, i32::max_value()].iter().cloned().product::<i32>(); }); assert!(r.is_err()); } </ins>