diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2020-04-17 21:42:22 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2020-05-06 08:14:21 -0400 |
| commit | 9907ad6ed9fde5ccdb58a7d59d652a4c8a98a346 (patch) | |
| tree | 7470f8e3ea081729bd155d40dab7310f601c5940 /src/test/ui | |
| parent | a0c61a904482129989f5c1e5cb9f1008efb76f7f (diff) | |
Define UB in float-to-int casts to saturate
- Round to zero, and representable values cast directly.
- `NaN` goes to 0
- Values beyond the limits of the type are saturated to the "nearest value"
(essentially rounding to zero, in some sense) in the integral type, so e.g.
`f32::INFINITY` would go to `{u,i}N::MAX.`
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/numbers-arithmetic/saturating-float-casts.rs | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/test/ui/numbers-arithmetic/saturating-float-casts.rs b/src/test/ui/numbers-arithmetic/saturating-float-casts.rs index f13964fb386..811efaefbb5 100644 --- a/src/test/ui/numbers-arithmetic/saturating-float-casts.rs +++ b/src/test/ui/numbers-arithmetic/saturating-float-casts.rs @@ -1,6 +1,5 @@ // run-pass // Tests saturating float->int casts. See u128-as-f32.rs for the opposite direction. -// compile-flags: -Z saturating-float-casts #![feature(test, stmt_expr_attributes)] #![deny(overflowing_literals)] |
