From e476d05c8ff8fa149b31a9a02d6fa5503ccdd1af Mon Sep 17 00:00:00 2001 From: dswij Date: Wed, 6 Oct 2021 15:33:05 +0800 Subject: [PATCH] Add tests for zero exponents in `excessive_precision` --- tests/ui/excessive_precision.fixed | 3 +++ tests/ui/excessive_precision.rs | 3 +++ tests/ui/excessive_precision.stderr | 8 +++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/ui/excessive_precision.fixed b/tests/ui/excessive_precision.fixed index 65096d6b219..b74bda182be 100644 --- a/tests/ui/excessive_precision.fixed +++ b/tests/ui/excessive_precision.fixed @@ -63,4 +63,7 @@ fn main() { // issue #7744 let _ = 2.225_073_858_507_201e-308_f64; + + // issue #7745 + let _ = 0_f64; } diff --git a/tests/ui/excessive_precision.rs b/tests/ui/excessive_precision.rs index 4db6e4d4831..6e84a71f24c 100644 --- a/tests/ui/excessive_precision.rs +++ b/tests/ui/excessive_precision.rs @@ -63,4 +63,7 @@ fn main() { // issue #7744 let _ = 2.225_073_858_507_201_1e-308_f64; + + // issue #7745 + let _ = 1.000_000_000_000_001e-324_f64; } diff --git a/tests/ui/excessive_precision.stderr b/tests/ui/excessive_precision.stderr index c9418f73d98..42d9d4de193 100644 --- a/tests/ui/excessive_precision.stderr +++ b/tests/ui/excessive_precision.stderr @@ -84,5 +84,11 @@ error: float has excessive precision LL | let _ = 2.225_073_858_507_201_1e-308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `2.225_073_858_507_201e-308_f64` -error: aborting due to 14 previous errors +error: float has excessive precision + --> $DIR/excessive_precision.rs:68:13 + | +LL | let _ = 1.000_000_000_000_001e-324_f64; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0_f64` + +error: aborting due to 15 previous errors