-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-prettyArea: Pretty printing (including `-Z unpretty`)Area: Pretty printing (including `-Z unpretty`)
Milestone
Description
fn f() { if (1 == fail) { } else { } }
and
fn f() { if 1 == (fail) { } else { } }
lose their parens, becoming something that fails to parse:
fn f() { if 1 == fail { } else { } }
This could be solved by parenthesizing the whole discriminant, parenthesizing just the "fail", or getting rid of the syntactic ambiguity. I see a way to do the first option, by making pprust::print_maybe_parens_discrim recurse right. I could write that patch, along with tests, if you think it's the right thing to do.
Metadata
Metadata
Assignees
Labels
A-prettyArea: Pretty printing (including `-Z unpretty`)Area: Pretty printing (including `-Z unpretty`)