Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fails to keep a space before range .. when its LHS is a binary operation whose RHS is a float literal ending with . #6175

Closed
TonalidadeHidrica opened this issue May 24, 2024 · 5 comments

Comments

@TonalidadeHidrica
Copy link

I wonder how I can make the title short 🤔

In the following code, the space between 1. and .. must be kept, as together they form an illegal token ....

fn main() {
    let a = 0. + 1. ..2.;
}

Expected: no changes, found:

fn main() {
    let a = 0. + 1...2.;
}

Related: #3854 , but it only handles the case when LHS of .. is not a binary expression. Indeed, this code is not modified by rustfmt as expected:

fn main() {
    let a = 1. ..2.;
}
@TonalidadeHidrica TonalidadeHidrica changed the title Fails to keep a space before range .. when its LHS is a binary operation whose RHS is a float literal ending with . BUG: Fails to keep a space before range .. when its LHS is a binary operation whose RHS is a float literal ending with . May 24, 2024
@ytmimi
Copy link
Contributor

ytmimi commented May 24, 2024

Duplicate of #6059, and should already be fixed by #6085. Just hasn't been released yet.

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
@TonalidadeHidrica
Copy link
Author

It still presists on nightly build. Isn't the nightly build from the master branch d5f1200, which is later than the merge commit 73c8149?

$ pbpaste
fn main() {
    let a = 0. + 1. ..2.;
}
$ pbpaste | rustfmt +nightly
fn main() {
    let a = 0. + 1...2.;
}
$ rustfmt +nightly --version
rustfmt 1.7.0-nightly (8679004 2024-05-23)

@ytmimi
Copy link
Contributor

ytmimi commented May 24, 2024

Nope!

rustfmt and some other dev tools are git subtrees of the rust-lang/rust repo. rustfmt is developed here in rust-lang/rustfmt, but it's released from the in-tree source in rust-lang/rust.

Part of rustfmt's release process is syncing changes here with rust-lang/rust. Until we do our sync the changes won't be released.

@TonalidadeHidrica
Copy link
Author

Ah, that makes sense! Thank you for kindly telling me about it, and I am sorry for having disturbed you.

@ytmimi
Copy link
Contributor

ytmimi commented May 28, 2024

No worries. It can definitely be confusing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants