diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-05-06 16:58:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-06 16:58:50 +0200 |
| commit | 14d608f1d8a0b84da5f3bccecb3efb3d35f980dc (patch) | |
| tree | bb359957d2ab7197b0179d8f59310da9c1108520 /src/librustc_session | |
| parent | 339f574809bf8e4166b8de3cdbe7df181d37af3d (diff) | |
| parent | f63b8bffefb0f652dc164859f4c8a10329c9117a (diff) | |
| download | rust-14d608f1d8a0b84da5f3bccecb3efb3d35f980dc.tar.gz rust-14d608f1d8a0b84da5f3bccecb3efb3d35f980dc.zip | |
Rollup merge of #71269 - Mark-Simulacrum:sat-float-casts, r=nikic
Define UB in float-to-int casts to saturate This closes #10184 by defining the behavior there to saturate infinities and values exceeding the integral range (on the lower or upper end). `NaN` is sent to zero.
Diffstat (limited to 'src/librustc_session')
| -rw-r--r-- | src/librustc_session/options.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_session/options.rs b/src/librustc_session/options.rs index 984d47956ca..1d314238b86 100644 --- a/src/librustc_session/options.rs +++ b/src/librustc_session/options.rs @@ -938,9 +938,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "enable origins tracking in MemorySanitizer"), sanitizer_recover: Vec<Sanitizer> = (vec![], parse_sanitizer_list, [TRACKED], "enable recovery for selected sanitizers"), - saturating_float_casts: bool = (false, parse_bool, [TRACKED], + saturating_float_casts: Option<bool> = (None, parse_opt_bool, [TRACKED], "make float->int casts UB-free: numbers outside the integer type's range are clipped to \ - the max/min integer respectively, and NaN is mapped to 0 (default: no)"), + the max/min integer respectively, and NaN is mapped to 0 (default: yes)"), save_analysis: bool = (false, parse_bool, [UNTRACKED], "write syntax and type analysis (in JSON format) information, in \ addition to normal output (default: no)"), |
