-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
resolve/expand: Cache intermediate results of #[derive]
expansion
#82907
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 45589d2e6e7af5866c804666bf52cbc0e671c2d5 with merge cc63cfbd3047bd17037ca21fa2ac23c7abfe4600... |
☀️ Try build successful - checks-actions |
Queued cc63cfbd3047bd17037ca21fa2ac23c7abfe4600 with parent 1d6b0f6, future comparison URL. |
Finished benchmarking try commit (cc63cfbd3047bd17037ca21fa2ac23c7abfe4600): 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 |
The results are within the noise, but I'd still like to land this as a refactoring, because it will help with another caching-related FIXME in |
This comment has been minimized.
This comment has been minimized.
It's been almost a month. |
Updated. |
@bors r+ |
📌 Commit b965844 has been approved by |
⌛ Testing commit b965844 with merge 284954f5b9a7702c697585ee899ef91f68ac4dc1... |
Spurious failure |
💔 Test failed - checks-actions |
☀️ Test successful - checks-actions |
Expansion function for
#[derive]
(rustc_builtin_macros::derive::Expander::expand
) may return an indeterminate result, and therefore can be called multiple times.Previously we parsed the
#[derive(Foo, Bar)]
's input and tried to resolveFoo
andBar
on every such call.Now we maintain a cache
Resolver::derive_data
and take all the necessary data from it if it was computed previously.So
Foo, Bar
is now parsed at most once, andFoo
andBar
are successfully resolved at most once.