Skip to content

division in where clause leads to incorrect formatting #4218

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

Closed
lcnr opened this issue May 31, 2020 · 0 comments · Fixed by #4220
Closed

division in where clause leads to incorrect formatting #4218

lcnr opened this issue May 31, 2020 · 0 comments · Fixed by #4220

Comments

@lcnr
Copy link
Contributor

lcnr commented May 31, 2020

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

@lcnr lcnr changed the title division in where build leads to incorrect formatting division in where clause leads to incorrect formatting May 31, 2020
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue May 31, 2020
calebcartwright pushed a commit that referenced this issue May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant