Commit b3f9117
authored
Rollup merge of rust-lang#124191 - dtolnay:fixup, r=compiler-errors
Give a name to each distinct manipulation of pretty-printer FixupContext
There are only 7 distinct ways that the AST pretty-printer interacts with FixupContext: 3 constructors (including Default), 2 transformations, and 2 queries.
This PR turns these into associated functions which can be documented with examples.
This PR unblocks rust-lang#119427 (comment). In order to improve the pretty-printer's behavior regarding parenthesization of braced macro calls in match arms, which have different grammar than macro calls in statements, FixupContext needs to be extended with 2 new fields. In the previous approach, that would be onerous. In the new approach, all it entails is 1 new constructor (`FixupContext::new_match_arm()`).4 files changed
+178
-224
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
1252 | 1252 | | |
1253 | 1253 | | |
1254 | 1254 | | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
| 1255 | + | |
1260 | 1256 | | |
1261 | 1257 | | |
1262 | 1258 | | |
1263 | 1259 | | |
1264 | 1260 | | |
1265 | 1261 | | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
| 1262 | + | |
1271 | 1263 | | |
1272 | 1264 | | |
1273 | 1265 | | |
| |||
1319 | 1311 | | |
1320 | 1312 | | |
1321 | 1313 | | |
1322 | | - | |
1323 | | - | |
1324 | | - | |
1325 | | - | |
1326 | | - | |
| 1314 | + | |
1327 | 1315 | | |
1328 | 1316 | | |
1329 | 1317 | | |
| |||
1367 | 1355 | | |
1368 | 1356 | | |
1369 | 1357 | | |
1370 | | - | |
1371 | | - | |
| 1358 | + | |
1372 | 1359 | | |
1373 | 1360 | | |
1374 | 1361 | | |
| |||
0 commit comments