about summary refs log tree commit diff
path: root/src/test/debuginfo/enum-thinlto.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2019-11-28 15:24:26 +0100
committerSimon Sapin <simon.sapin@exyr.org>2019-12-06 14:01:05 +0100
commitcba479f75c7513f91f727741882a99442f393c12 (patch)
treeb9dcaf3f1f8510c49370bf91381ac568256911b8 /src/test/debuginfo/enum-thinlto.rs
parentf442797c17f8f1f6ff217d48e664018359bdd6bc (diff)
downloadrust-cba479f75c7513f91f727741882a99442f393c12.tar.gz
rust-cba479f75c7513f91f727741882a99442f393c12.zip
Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methods
As discussed in https://github.com/rust-lang/rust/issues/10184

Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range.
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions