Commit 0a56446
committed
feat(hygiene): Collect loaded proc macros using all_proc_macro_def_ids
The recently introduced CStore::all_proc_macro_def_ids function exposes the information on the loaded proc macos we were trying to access, for which we had to use custom workarounds before. The previous workaround relied on enumerating the def indices of each proc macro crate, and then attempting to read the def entries of each of the def indices within to find the proc macro entries. This wasn't much of a performance concern due to the general size of proc macro crates and the reads being made to previously cached metadata. However, because proc macro crates have a different rmeta representation which removes lots of unnecessary def entries, and because the publicly accessible interfaces (CStore::def_kind_untracked, CStore::load_proc_macro_untracked) all panicked upon a missing def entry, we had to catch panics and even remove the panic hook for the duration of these lookups to gather the information on loaded proc macros that this new publicly-available interface now provides.
We primarily use information on loaded proc macros to clean up residual helper attributes which are left behind after proc macro expansion, and are not interpretable without the call to the proc macro.1 parent 963bede commit 0a56446
1 file changed
Lines changed: 1 addition & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
1807 | 1806 | | |
1808 | 1807 | | |
1809 | 1808 | | |
1810 | | - | |
1811 | | - | |
1812 | | - | |
1813 | | - | |
1814 | | - | |
1815 | | - | |
1816 | | - | |
1817 | | - | |
1818 | | - | |
1819 | | - | |
1820 | 1809 | | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
1824 | | - | |
1825 | | - | |
1826 | | - | |
1827 | | - | |
1828 | | - | |
1829 | | - | |
1830 | | - | |
1831 | | - | |
1832 | | - | |
1833 | | - | |
1834 | | - | |
1835 | | - | |
1836 | | - | |
1837 | | - | |
1838 | | - | |
1839 | | - | |
| 1810 | + | |
1840 | 1811 | | |
1841 | 1812 | | |
1842 | 1813 | | |
| |||
0 commit comments