mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
e9740a4be5
The pretty printer was collapsing unsuffixed float literals (like `0.`) with adjacent dot tokens, producing ambiguous or invalid output: - `0. ..45.` (range) became `0...45.` - `0. ..=360.` (inclusive range) became `0...=360.` - `0. .to_string()` (method call) became `0..to_string()` The fix inserts a space after an unsuffixed float literal ending with `.` when it appears as the start expression of a range operator or the receiver of a method call or field access, preventing the trailing dot from merging with the following `.`, `..`, or `..=` token. This is skipped when the expression is already parenthesized, since the closing `)` naturally provides separation. Signed-off-by: Andrew V. Teylu <andrew.teylu@vector.com>
9 lines
122 B
Rust
9 lines
122 B
Rust
//@ pp-exact
|
|
|
|
fn main() {
|
|
let _ = 0. ..45.;
|
|
let _ = 0. ..=360.;
|
|
let _ = 0. ..;
|
|
let _ = 0. .to_string();
|
|
}
|