diff options
| author | Corey Richardson <corey@octayn.net> | 2015-01-06 00:56:30 -0500 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-03-03 12:09:07 +0100 |
| commit | cdfff9db35d037c51dfd5c2bac2174f651294adb (patch) | |
| tree | 92ffb0978f93db6b8a74531b1f3abef2ab599e6f /src/librustc/session | |
| parent | 00ccc7af1eb9091de7f24edf9eacb3da119d5b27 (diff) | |
| download | rust-cdfff9db35d037c51dfd5c2bac2174f651294adb.tar.gz rust-cdfff9db35d037c51dfd5c2bac2174f651294adb.zip | |
rustc: implement arithmetic overflow checking
Adds overflow checking to integer addition, multiplication, and subtraction when `-Z force-overflow-checks` is true, or if `--cfg ndebug` is not passed to the compiler. On overflow, it panics with `arithmetic operation overflowed`. Also adds `overflowing_add`, `overflowing_sub`, and `overflowing_mul` intrinsics for doing unchecked arithmetic. [breaking-change]
Diffstat (limited to 'src/librustc/session')
| -rw-r--r-- | src/librustc/session/config.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index efcde8b2fa1..53c1f4e4a40 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -259,7 +259,6 @@ pub enum CrateType { CrateTypeStaticlib, } - #[derive(Clone)] pub enum Passes { SomePasses(Vec<String>), @@ -585,6 +584,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "Adds unstable command line options to rustc interface"), print_enum_sizes: bool = (false, parse_bool, "Print the size of enums and their variants"), + force_overflow_checks: Option<bool> = (None, parse_opt_bool, + "Force overflow checks on or off"), } pub fn default_lib_output() -> CrateType { |
