logoalt Hacker News

norman784last Tuesday at 5:59 PM1 replyview on HN

The issue with Rust proc macros is that they are impure, so even with incremental compilation, you need to expand them every time.


Replies

afdbcreidyesterday at 5:42 AM

That's only part of the issue. First, declarative macros are of course pure. Most procedural macros are pure too, although there are exceptions (an infamous case is sqlx). And while rustc does expand them every time (although a config for declaring "my macro is pure" was considered multiple times and the teams generally view it favorably), rust-analyzer just declares "we don't support impure macros" and caches them anyway.