diff options
| author | bors <bors@rust-lang.org> | 2021-11-06 07:15:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-06 07:15:05 +0000 |
| commit | 7276a6a11768634c1e7df5605a83a0f117302c50 (patch) | |
| tree | 2075f2caf1dc3e2d1f5208252f9b1df2605c76d3 /compiler/rustc_mir_transform/src/coverage/mod.rs | |
| parent | 9d39f6ab7dec5b8c6e8d9ce52a1f15b9e656c900 (diff) | |
| parent | 1f9807799c5f70c3a215698ad6e8eb8a03725969 (diff) | |
| download | rust-7276a6a11768634c1e7df5605a83a0f117302c50.tar.gz rust-7276a6a11768634c1e7df5605a83a0f117302c50.zip | |
Auto merge of #90297 - dtolnay:dotzero, r=petrochenkov
Append .0 to unsuffixed float if it would otherwise become int token Previously the unsuffixed f32/f64 constructors of `proc_macro::Literal` would create literal tokens that are definitely not a float: ```rust Literal::f32_unsuffixed(10.0) // 10 Literal::f32_suffixed(10.0) // 10f32 Literal::f64_unsuffixed(10.0) // 10 Literal::f64_suffixed(10.0) // 10f64 ``` Notice that the `10` are actually integer tokens if you were to reparse them, not float tokens. This diff updates `Literal::f32_unsuffixed` and `Literal::f64_unsuffixed` to produce tokens that unambiguously parse as a float. This matches longstanding behavior of the proc-macro2 crate's implementation of these APIs dating back at least 3.5 years, so it's likely an unobjectionable behavior. ```rust Literal::f32_unsuffixed(10.0) // 10.0 Literal::f32_suffixed(10.0) // 10f32 Literal::f64_unsuffixed(10.0) // 10.0 Literal::f64_suffixed(10.0) // 10f64 ``` Fixes https://github.com/dtolnay/syn/issues/1085.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions
