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.
This commit is contained in:
Dylan DPC 2020-05-06 16:58:50 +02:00 committed by GitHub
commit 14d608f1d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 420 additions and 52 deletions

View file

@ -559,7 +559,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(sanitizer, Some(Sanitizer::Address));
tracked!(sanitizer_memory_track_origins, 2);
tracked!(sanitizer_recover, vec![Sanitizer::Address]);
tracked!(saturating_float_casts, true);
tracked!(saturating_float_casts, Some(true));
tracked!(share_generics, Some(true));
tracked!(show_span, Some(String::from("abc")));
tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));