Commit d4c6f40
committed
Auto merge of rust-lang#54485 - arielb1:avoid-ctor-attrs, r=eddyb
avoid loading constructor attributes in AdtDef decoding
During metadata loading, the AdtDefs for every ADT in the universe need
to be loaded (for example, for coherence of builtin traits). For that,
the attributes of the AdtDef need to be loaded too.
The attributes of a struct are duplicated between 2 def ids - the
constructor def-id, and the "type" def id. Loading attributes for both
def-ids, which was done in rust-lang#53721, slowed the compilation of small
crates by 2-3%. This PR makes sure we only load the attributes for the
"type" def-id, avoiding the slowdown.
r? @eddyb & cc @nnethercoteFile tree
3 files changed
+30
-11
lines changed- src
- librustc_metadata
- librustc_typeck
- librustc/ty
3 files changed
+30
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1724 | 1724 | | |
1725 | 1725 | | |
1726 | 1726 | | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1727 | 1736 | | |
1728 | 1737 | | |
1729 | 1738 | | |
1730 | 1739 | | |
1731 | 1740 | | |
1732 | 1741 | | |
1733 | | - | |
| 1742 | + | |
| 1743 | + | |
1734 | 1744 | | |
1735 | 1745 | | |
1736 | | - | |
1737 | | - | |
| 1746 | + | |
| 1747 | + | |
1738 | 1748 | | |
1739 | | - | |
| 1749 | + | |
1740 | 1750 | | |
1741 | 1751 | | |
1742 | 1752 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
559 | 562 | | |
560 | 563 | | |
561 | | - | |
| 564 | + | |
562 | 565 | | |
563 | 566 | | |
564 | 567 | | |
| |||
570 | 573 | | |
571 | 574 | | |
572 | 575 | | |
573 | | - | |
| 576 | + | |
| 577 | + | |
574 | 578 | | |
575 | 579 | | |
576 | 580 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
| 558 | + | |
| 559 | + | |
559 | 560 | | |
560 | 561 | | |
561 | 562 | | |
| |||
592 | 593 | | |
593 | 594 | | |
594 | 595 | | |
595 | | - | |
| 596 | + | |
| 597 | + | |
596 | 598 | | |
597 | 599 | | |
598 | 600 | | |
| |||
622 | 624 | | |
623 | 625 | | |
624 | 626 | | |
625 | | - | |
| 627 | + | |
| 628 | + | |
626 | 629 | | |
627 | 630 | | |
628 | 631 | | |
| |||
642 | 645 | | |
643 | 646 | | |
644 | 647 | | |
645 | | - | |
| 648 | + | |
| 649 | + | |
646 | 650 | | |
647 | 651 | | |
648 | 652 | | |
| |||
654 | 658 | | |
655 | 659 | | |
656 | 660 | | |
657 | | - | |
| 661 | + | |
| 662 | + | |
658 | 663 | | |
659 | 664 | | |
660 | 665 | | |
| |||
0 commit comments