-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit 7ac2d1f
committed
Improve HIR pretty-printing of if/else some more.
In the AST the "then" block is represented as a `Block`. In HIR the
"then" block is represented as an `Expr` that happens to always be.
`ExprKind::Block`. By deconstructing the `ExprKind::Block` to extract
the block within, things print properly.
For `issue-82392.rs`, note that we no longer print a type after the
"then" block. This is good, it now matches how we don't print a type for
the "else" block. (Well, we do print a type after the "else" block, but
it's for the whole if/else.)
Also tighten up some of the pattern matching -- these block expressions
within if/else will never have labels.1 parent e37c367 commit 7ac2d1f
File tree
4 files changed
+37
-41
lines changed- compiler
- rustc_ast_pretty/src/pprust/state
- rustc_hir_pretty/src
- tests
- pretty
- ui/match
4 files changed
+37
-41
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 | - | ||
33 | + | ||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1064 | 1064 |
| |
1065 | 1065 |
| |
1066 | 1066 |
| |
1067 | - | ||
1067 | + | ||
1068 | 1068 |
| |
1069 | 1069 |
| |
1070 | 1070 |
| |
1071 | 1071 |
| |
1072 | 1072 |
| |
1073 | - | ||
1073 | + | ||
1074 | 1074 |
| |
1075 | 1075 |
| |
1076 | 1076 |
| |
1077 | - | ||
1077 | + | ||
1078 | 1078 |
| |
1079 | 1079 |
| |
1080 | 1080 |
| |
| |||
1099 | 1099 |
| |
1100 | 1100 |
| |
1101 | 1101 |
| |
1102 | - | ||
1103 | - | ||
1102 | + | ||
1103 | + | ||
1104 | + | ||
1105 | + | ||
1106 | + | ||
1107 | + | ||
1108 | + | ||
1104 | 1109 |
| |
1105 | 1110 |
| |
1106 | 1111 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 | - | ||
16 | - | ||
17 | - | ||
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | ||
22 | - | ||
23 | - | ||
24 | - | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
25 | 20 |
| |
26 | - | ||
27 | - | ||
28 | - | ||
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | ||
34 | - | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
35 | 29 |
| |
36 | - | ||
37 | - | ||
38 | - | ||
39 | - | ||
40 | - | ||
41 | - | ||
42 | - | ||
43 | - | ||
44 | - | ||
45 | - | ||
46 | - | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
47 | 38 |
| |
48 | - | ||
39 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 | - | ||
12 | - | ||
13 | - | ||
11 | + | ||
12 | + | ||
14 | 13 |
| |
15 | 14 |
| |
16 | - | ||
15 | + | ||
17 | 16 |
| |
17 | + |
0 commit comments