about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-10-20 04:35:10 +0900
committerGitHub <noreply@github.com>2021-10-20 04:35:10 +0900
commitca6798ab073c4f2358f2577e7258108099f29144 (patch)
tree32f4e71f7579abd2cc56f7b991f3a8c80e966336 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
parent1af55d19c7a9189374d89472f97dc119659bb67e (diff)
parent8731d4dfb479914a91f650f4f124528e332e8128 (diff)
downloadrust-ca6798ab073c4f2358f2577e7258108099f29144.tar.gz
rust-ca6798ab073c4f2358f2577e7258108099f29144.zip
Rollup merge of #86479 - exphp-forks:float-debug-exponential, r=yaahc
Automatic exponential formatting in Debug

Context: See [this comment from the libs team](https://github.com/rust-lang/rfcs/pull/2729#issuecomment-853454204)

---

Makes `"{:?}"` switch to exponential for floats based on magnitude. The libs team suggested exploring this idea in the discussion thread for RFC rust-lang/rfcs#2729. (**note:** this is **not** an implementation of the RFC; it is an implementation of one of the alternatives)

Thresholds chosen were 1e-4 and 1e16.  Justification described [here](https://github.com/rust-lang/rfcs/pull/2729#issuecomment-864482954).

**This will require a crater run.**

---

As mentioned in the commit message of 8731d4dfb47, this behavior will not apply when a precision is supplied, because I wanted to preserve the following existing and useful behavior of `{:.PREC?}` (which recursively applies `{:.PREC}` to floats in a struct):

```rust
assert_eq!(
    format!("{:.2?}", [100.0, 0.000004]),
    "[100.00, 0.00]",
)
```

I looked around and am not sure where there are any tests that actually use this in the test suite, though?

All things considered, I'm surprised that this change did not seem to break even a single existing test in `x.py test --stage 2`.  (even when I tried a smaller threshold of 1e6)
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions