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

Left behind trailing whitespace when formatting where bound with empty right hand side #4850

Closed
5225225 opened this issue May 25, 2021 · 2 comments · Fixed by #5019
Closed
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@5225225
Copy link

5225225 commented May 25, 2021

With a default rustfmt gotten from rustup (version rustfmt 1.4.37-nightly (5dc8789 2021-05-21)
), the following leaves whitespace after the where bound, and gives an internal error about leaving trailing whitespace.

struct ThisIsALongStructNameToPushTheWhereToWrapLolololol;

const fn this_is_a_long_const_function_name() -> usize {
    0
}

impl ThisIsALongStructNameToPushTheWhereToWrapLolololol where
    [(); this_is_a_long_const_function_name()]: 
{
}

echo "c3RydWN0IFRoaXNJc0FMb25nU3RydWN0TmFtZVRvUHVzaFRoZVdoZXJlVG9XcmFwTG9sb2xvbG9sOwoKY29uc3QgZm4gdGhpc19pc19hX2xvbmdfY29uc3RfZnVuY3Rpb25fbmFtZSgpIC0 IHVzaXplIHsKICAgIDAKfQoKaW1wbCBUaGlzSXNBTG9uZ1N0cnVjdE5hbWVUb1B1c2hUaGVXaGVyZVRvV3JhcExvbG9sb2xvbCB3aGVyZQogICAgWygpOyB0aGlzX2lzX2FfbG9uZ19jb25zdF9mdW5jdGlvbl9uYW1lKCldOiAKewp9Cg==" | base64 -d | rustfmt is the file as base64.

Testing the code on 129c888 (Current head of master) shows the same issue. I tried getting branch v2.0.0-rc.2 working to test it there, but got a build failure.

I did see that there's been other issues opened for leaving behind trailing whitespace, but didn't see one for this specific case.

@calebcartwright calebcartwright added the bug Panic, non-idempotency, invalid code, etc. label Jun 4, 2021
@calebcartwright
Copy link
Member

Thanks for the report!

I did see that there's been other issues opened for leaving behind trailing whitespace, but didn't see one for this specific case.

No worries, with these particular cases it's better to open a new issue since the "error[internal]: left behind trailing whitespace" is a common symptom that can occur with a wide variety of root causes

@ytmimi
Copy link
Contributor

ytmimi commented Oct 9, 2021

I'm pretty sure #5019 fixes this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants