Skip to content

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

@ghost

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICE

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions