about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2023-11-17 12:56:31 +0900
committerGitHub <noreply@github.com>2023-11-17 12:56:31 +0900
commitc77cb7a3f679269166fa00c41d88b12243d8f7d5 (patch)
tree67b8cbb51620616966344a912d274f062fdebdfc
parent3c0f22d99c12c2318aa53b3311c8872dcefb86d2 (diff)
parent1c1b7897d8dc7edc25bdbb0eabf082a5b65bb0bd (diff)
downloadrust-c77cb7a3f679269166fa00c41d88b12243d8f7d5.tar.gz
rust-c77cb7a3f679269166fa00c41d88b12243d8f7d5.zip
Rollup merge of #117946 - RalfJung:miri-libcore-test, r=Mark-Simulacrum
avoid exhaustive i16 test in Miri

https://github.com/rust-lang/rust/pull/116301 added a test that is way too slow to be running in Miri. So let's only test a few hopefully representative cases.
-rw-r--r--library/core/tests/fmt/num.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/library/core/tests/fmt/num.rs b/library/core/tests/fmt/num.rs
index 1ddcd5ab795..bc387a46ea7 100644
--- a/library/core/tests/fmt/num.rs
+++ b/library/core/tests/fmt/num.rs
@@ -152,8 +152,11 @@ fn test_format_int_exp_precision() {
     assert_eq!(format!("{:+10.3e}", 1), "  +1.000e0");
 
     // test precision remains correct when rounding to next power
-
-    for i in i16::MIN..=i16::MAX {
+    #[cfg(miri)] // can't cover all of `i16` in Miri
+    let range = [i16::MIN, -1, 1, i16::MAX];
+    #[cfg(not(miri))]
+    let range = i16::MIN..=i16::MAX;
+    for i in range {
         for p in 0..=5 {
             assert_eq!(
                 format!("{i:.p$e}"),