Commit 71d6e76
committed
Auto merge of #58140 - eddyb:advent-of-print, r=nikomatsakis
Refactor ppaux out of existence.
A long-time coming, this PR reorganizes and rewrites the pretty-printing architecture of rustc, specifically the parts that involve the typesystem (which used to be in `rustc::util::ppaux`).
*Note: these commits used to be in #57967 before being split off.*
The new API (i.e. the `Printer` and `PrettyPrint` traits) is in `rustc::ty::print`.
Design points, roughly:
* using associated types in `Printer` to allow building e.g. an AST, not just printing as a side-effect
* several overloading points for implementers of `PrettyPrinter`, e.g. how `<...>` is printed
* for `fmt::Display` impls, the value to print is lifted to the `ty::tls` `tcx`, and everything after that stays within the `ty::print` API, which requires `'tcx` to match between values and the printer's `tcx`, without going through `fmt::Display` again
Most of the behavior is unchanged, except for a few details, which should be clear from the test changes.
r? @nikomatsakis
Fixes #55464File tree
139 files changed
+3385
-2906
lines changed- src
- librustc_borrowck/borrowck
- librustc_codegen_llvm
- librustc_codegen_ssa
- mir
- traits
- librustc_codegen_utils
- librustc_driver
- librustc_incremental
- persist
- librustc_lint
- librustc_mir
- borrow_check
- nll
- explain_borrow
- region_infer/error_reporting
- hair
- cx
- pattern
- interpret
- monomorphize
- transform
- util
- librustc_privacy
- librustc_save_analysis
- librustc_typeck
- check
- method
- coherence
- variance
- librustc
- dep_graph
- hir
- map
- infer
- error_reporting
- nice_region_error
- outlives
- middle
- mir
- traits
- specialize
- ty
- print
- query
- util
- librustdoc
- clean
- libsyntax
- test
- mir-opt
- ui
- associated-types
- bad
- confuse-field-and-method
- consts
- miri_unleashed
- deprecation
- impl-trait
- issues
- issue-37311-type-length-limit
- namespace
- nll/closure-requirements
- privacy
- regions
- symbol-names
- typeck
- unboxed-closures
- underscore-lifetime
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
139 files changed
+3385
-2906
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
724 | 724 | | |
725 | 725 | | |
726 | 726 | | |
727 | | - | |
| 727 | + | |
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
| |||
736 | 736 | | |
737 | 737 | | |
738 | 738 | | |
739 | | - | |
| 739 | + | |
740 | 740 | | |
741 | 741 | | |
742 | 742 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
679 | 679 | | |
680 | 680 | | |
681 | 681 | | |
682 | | - | |
| 682 | + | |
683 | 683 | | |
684 | | - | |
| 684 | + | |
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
688 | | - | |
| 688 | + | |
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1351 | 1351 | | |
1352 | 1352 | | |
1353 | 1353 | | |
1354 | | - | |
| 1354 | + | |
| 1355 | + | |
1355 | 1356 | | |
1356 | 1357 | | |
1357 | 1358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
447 | 532 | | |
448 | 533 | | |
449 | 534 | | |
450 | 535 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
455 | 541 | | |
456 | 542 | | |
457 | | - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
458 | 550 | | |
459 | 551 | | |
460 | 552 | | |
| |||
658 | 750 | | |
659 | 751 | | |
660 | 752 | | |
661 | | - | |
| 753 | + | |
662 | 754 | | |
663 | 755 | | |
664 | 756 | | |
| |||
683 | 775 | | |
684 | 776 | | |
685 | 777 | | |
686 | | - | |
| 778 | + | |
687 | 779 | | |
688 | 780 | | |
689 | 781 | | |
| |||
742 | 834 | | |
743 | 835 | | |
744 | 836 | | |
745 | | - | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
746 | 843 | | |
747 | | - | |
| 844 | + | |
748 | 845 | | |
749 | | - | |
750 | 846 | | |
751 | 847 | | |
752 | 848 | | |
| |||
757 | 853 | | |
758 | 854 | | |
759 | 855 | | |
760 | | - | |
761 | | - | |
| 856 | + | |
| 857 | + | |
762 | 858 | | |
763 | 859 | | |
764 | 860 | | |
| |||
1013 | 1109 | | |
1014 | 1110 | | |
1015 | 1111 | | |
1016 | | - | |
| 1112 | + | |
1017 | 1113 | | |
1018 | 1114 | | |
1019 | 1115 | | |
| |||
1425 | 1521 | | |
1426 | 1522 | | |
1427 | 1523 | | |
1428 | | - | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
1429 | 1528 | | |
1430 | 1529 | | |
1431 | 1530 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 78 | + | |
75 | 79 | | |
76 | | - | |
77 | | - | |
78 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
79 | 89 | | |
80 | 90 | | |
81 | 91 | | |
| |||
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
87 | | - | |
| 97 | + | |
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
| |||
0 commit comments