-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encode less metadata for proc-macro crates #76897
Encode less metadata for proc-macro crates #76897
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit c0a1bccc2956267914c3f843acf0552cf100025b with merge 8364b62485652df7e6f55f5d5b925082ad5b9094... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 8364b62485652df7e6f55f5d5b925082ad5b9094 with parent bbc6774, future comparison URL. |
Finished benchmarking try commit (8364b62485652df7e6f55f5d5b925082ad5b9094): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 2341efee2714b050e7144d1a6e5c678f4c6bc11e with merge 9d18afcee1a0378a6656c876de82486d528525e7... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 9d18afcee1a0378a6656c876de82486d528525e7 with parent c6ab8e5, future comparison URL. |
Finished benchmarking try commit (9d18afcee1a0378a6656c876de82486d528525e7): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit bc917942284b2721f542ca4348a8706999d2d01a with merge a16f40b1158cae86e56721c06794efa04f3918ce... |
☀️ Try build successful - checks-actions, checks-azure |
cc @rust-lang/infra A perf run didn't get queued for some reason |
@rust-timer build a16f40b1158cae86e56721c06794efa04f3918ce |
Queued a16f40b1158cae86e56721c06794efa04f3918ce with parent 59fb88d, future comparison URL. |
Finished benchmarking try commit (a16f40b1158cae86e56721c06794efa04f3918ce): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
r=me with nits addressed. |
bc91794
to
be40cd3
Compare
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.
be40cd3
to
b965356
Compare
@bors r=petrochenkov |
📌 Commit b965356 has been approved by |
☀️ Test successful - checks-actions, checks-azure |
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 leftcompletetly 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 #75465, but was missed
for proc-macros.
As a result of this PR, we should only ever encode local
CrateNum
swhen encoding proc-macro crates. I've added a specialized serialization
impl for
CrateNum
to assert this.