Skip to content

division in where clause leads to incorrect formatting #4218

Closed
@lcnr

Description

@lcnr
Contributor

rustfmt incorrectly formats the following code:

pub struct Arr
    where [u8;  {10 / 2}]: Send
{}

as

pub struct Arr
where
    [u8; { 10 / 2 }]: Send, {
    10 / 2}]: Send
{}

Both the braces and the division are required.
This bug does not happen for where bounds on traits.

pub trait Arr
    where [u8;  {10 / 2}]: Send
{}
// This is formatted correctly

Found while looking at rust-lang/rust#72819

Activity

changed the title [-]division in where build leads to incorrect formatting[/-] [+]division in where clause leads to incorrect formatting[/+] on May 31, 2020
added a commit that references this issue on May 31, 2020
f03346b
added a commit that references this issue on May 31, 2020
494452b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @lcnr

      Issue actions

        division in where clause leads to incorrect formatting · Issue #4218 · rust-lang/rustfmt