Skip to content

Fix syntax in -Zunpretty-expanded output for derived PartialEq.#107488

Merged
bors merged 1 commit intorust-lang:masterfrom
nnethercote:fix-PartialEq-syntax
Feb 2, 2023
Merged

Fix syntax in -Zunpretty-expanded output for derived PartialEq.#107488
bors merged 1 commit intorust-lang:masterfrom
nnethercote:fix-PartialEq-syntax

Conversation

@nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Jan 30, 2023

If you do derive(PartialEq) on a packed struct, the output shown by -Zunpretty=expanded includes expressions like this:

{ self.x } == { other.x }

This is invalid syntax. This doesn't break compilation, because the AST nodes are constructed within the compiler. But it does mean anyone using -Zunpretty=expanded output as a guide for hand-written impls could get a nasty surprise.

This commit fixes things by instead using this form:

({ self.x }) == ({ other.x })

r? @RalfJung

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants