3

Github resolve/expand: Cache intermediate results of `#[derive]` expansion by pe...

 3 years ago
source link: https://github.com/rust-lang/rust/pull/82907
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

petrochenkov commented on Mar 8

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK