Commit 623fb90
committed
Auto merge of rust-lang#76897 - Aaron1011:feature/min-proc-macro-metadata, r=petrochenkov
Encode less metadata for proc-macro crates
Currently, we serialize the same crate metadata for proc-macro crates as
we do for normal crates. This is quite wasteful - almost none of this
metadata is ever used, and much of it can't even be deserialized (if it
contains a foreign `CrateNum`).
This PR changes metadata encoding to skip encoding the majority of crate
metadata for proc-macro crates. Most of the `Lazy<[T]>` fields are left
completetly empty, while the non-lazy fields are left as-is.
Additionally, proc-macros now have a def span that does not include
their body. This was done for normal functions in rust-lang#75465, but was missed
for proc-macros.
As a result of this PR, we should only ever encode local `CrateNum`s
when encoding proc-macro crates. I've added a specialized serialization
impl for `CrateNum` to assert this.File tree
4 files changed
+168
-60
lines changed- compiler/rustc_metadata/src/rmeta
- decoder
4 files changed
+168
-60
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
710 | | - | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
711 | 715 | | |
712 | 716 | | |
713 | 717 | | |
| |||
729 | 733 | | |
730 | 734 | | |
731 | 735 | | |
732 | | - | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
733 | 745 | | |
734 | 746 | | |
735 | 747 | | |
| |||
766 | 778 | | |
767 | 779 | | |
768 | 780 | | |
769 | | - | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
770 | 787 | | |
771 | 788 | | |
772 | 789 | | |
| |||
942 | 959 | | |
943 | 960 | | |
944 | 961 | | |
945 | | - | |
| 962 | + | |
946 | 963 | | |
947 | 964 | | |
948 | 965 | | |
| |||
1035 | 1052 | | |
1036 | 1053 | | |
1037 | 1054 | | |
1038 | | - | |
| 1055 | + | |
1039 | 1056 | | |
1040 | 1057 | | |
1041 | 1058 | | |
1042 | 1059 | | |
1043 | | - | |
| 1060 | + | |
| 1061 | + | |
1044 | 1062 | | |
1045 | 1063 | | |
1046 | 1064 | | |
1047 | 1065 | | |
1048 | 1066 | | |
1049 | 1067 | | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
| 1068 | + | |
1056 | 1069 | | |
1057 | 1070 | | |
1058 | 1071 | | |
| |||
1559 | 1572 | | |
1560 | 1573 | | |
1561 | 1574 | | |
1562 | | - | |
1563 | | - | |
1564 | | - | |
1565 | | - | |
1566 | | - | |
1567 | | - | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
1568 | 1588 | | |
1569 | 1589 | | |
1570 | 1590 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
| |||
0 commit comments