about summary refs log tree commit diff
diff options
context:
space:
mode:
authordswij <dswijj@gmail.com>2021-10-06 15:33:05 +0800
committerdswij <dswijj@gmail.com>2021-10-06 15:33:05 +0800
commite476d05c8ff8fa149b31a9a02d6fa5503ccdd1af (patch)
tree052af1d7c71b4c3113132c521bb28fdfed64f202
parent42f2304ce481628eaf6e6b01a95852ca4a8776e9 (diff)
downloadrust-e476d05c8ff8fa149b31a9a02d6fa5503ccdd1af.tar.gz
rust-e476d05c8ff8fa149b31a9a02d6fa5503ccdd1af.zip
Add tests for zero exponents in `excessive_precision`
-rw-r--r--tests/ui/excessive_precision.fixed3
-rw-r--r--tests/ui/excessive_precision.rs3
-rw-r--r--tests/ui/excessive_precision.stderr8
3 files changed, 13 insertions, 1 deletions
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