diff options
| author | bors <bors@rust-lang.org> | 2022-09-30 14:16:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-30 14:16:57 +0000 |
| commit | 75d3027fb5ce1af6712e4503c9574802212101bd (patch) | |
| tree | 3d5e1220422011356bf844bdc5e89561514b1774 /compiler/rustc_parse_format/src | |
| parent | f914b82a754c6d85c0a909ab152f5b611defef73 (diff) | |
| parent | e409ce2159e97514178633771dfd9eb05fc4327f (diff) | |
| download | rust-75d3027fb5ce1af6712e4503c9574802212101bd.tar.gz rust-75d3027fb5ce1af6712e4503c9574802212101bd.zip | |
Auto merge of #102484 - beetrees:duration-debug-bug-fix, r=scottmcm
Fix integer overflow in `format!("{:.0?}", Duration::MAX)`
Currently `format!("{:.0?}", Duration::MAX)` causes an integer overflow in the `Duration` `Debug` impl ([playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=67675c6895bdb2e37ee727f0ed7622b2)). This is because the carry from the rounding of the fractional_part into the integer_part will cause the integer_part to overflow as it is already `u64::MAX`. This PR uses a larger integer type to avoid that issue, and adds a test for the correct behaviour.
Diffstat (limited to 'compiler/rustc_parse_format/src')
0 files changed, 0 insertions, 0 deletions
