forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit 191ee56
authored
Rollup merge of rust-lang#107488 - nnethercote:fix-PartialEq-syntax, r=RalfJung
Fix syntax in `-Zunpretty-expanded` output for derived `PartialEq`.
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`File tree
3 files changed
+26
-8
lines changed- compiler
- rustc_builtin_macros/src/deriving/cmp
- rustc_expand/src
- tests/ui/deriving
3 files changed
+26
-8
lines changedLines changed: 19 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 | - | ||
33 | - | ||
34 | - | ||
35 | - | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
36 | 43 |
| |
37 | 44 |
| |
38 | 45 |
| |
39 | 46 |
| |
40 | - | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
41 | 54 |
| |
55 | + | ||
42 | 56 |
| |
43 | 57 |
| |
44 | 58 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
272 | 272 |
| |
273 | 273 |
| |
274 | 274 |
| |
275 | + | ||
276 | + | ||
277 | + | ||
278 | + | ||
275 | 279 |
| |
276 | 280 |
| |
277 | 281 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
209 | 209 |
| |
210 | 210 |
| |
211 | 211 |
| |
212 | - | ||
212 | + | ||
213 | 213 |
| |
214 | 214 |
| |
215 | 215 |
| |
| |||
718 | 718 |
| |
719 | 719 |
| |
720 | 720 |
| |
721 | - | ||
722 | - | ||
721 | + | ||
722 | + | ||
723 | 723 |
| |
724 | 724 |
| |
725 | 725 |
| |
|
0 commit comments