mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 09:13:07 +03:00
c755ee4ce8
resolve/expand: Cache intermediate results of `#[derive]` expansion 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 resolve `Foo` and `Bar` 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, and `Foo` and `Bar` are successfully resolved at most once.