You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
warning: Quasi-quoting might make incremental compilation very inefficient: NtIdent(..) #40946
When I use it, I get the warning in the title twice for every generated functions. When I move things into one crate to avoid "note: this error originates in a macro outside of the current crate", the span of the warning is on $proc_macro_name in #[proc_macro_derive($proc_macro_name)].
I don’t understand this warning and what I can do about it. What does quasi-quoting mean in this context? How bad is the inefficiency really? Is it possible to fix it while keeping this macro’s flexibility?
The $proc_macro_name turns into a Nonterminal::Ident token. Normally, nonterminals are parsed into AST and don't cause warnings. However, now that #40346 has landed, attributes can have arbitrary tokens and the Nonterminal::Ident token ends up in the final AST/HIR.
I believe the solution here is to expand interpolated/nonterminal tokens into their underlying terminal tokens as we lower to HIR.
Activity
michaelwoerister commentedon Apr 3, 2017
That's strange. @jseyfried, do you see anything in the macro above that in a
Token::Interpolated?This is where the warning is generated by the way:
rust/src/librustc_incremental/calculate_svh/svh_visitor.rs
Line 1068 in 5309a3e
michaelwoerister commentedon Apr 10, 2017
ping @jseyfried: Do you know what could be going on here? Where does the macro definition above introduce a
Token::Interpolated?jseyfried commentedon Apr 24, 2017
The
$proc_macro_nameturns into aNonterminal::Identtoken. Normally, nonterminals are parsed into AST and don't cause warnings. However, now that #40346 has landed, attributes can have arbitrary tokens and theNonterminal::Identtoken ends up in the final AST/HIR.I believe the solution here is to expand interpolated/nonterminal tokens into their underlying terminal tokens as we lower to HIR.
SimonSapin commentedon Apr 24, 2017
@jseyfried If I understand correctly, something is inefficient but what needs to change to fix it is in rustc rather than in my code?
michaelwoerister commentedon Apr 24, 2017
@SimonSapin That is correct. It's an inefficiency in rustc's handling of some parts of the HIR/AST.
michaelwoerister commentedon Apr 24, 2017
@jseyfried, that sounds like a great solution. Would that be much work?
jseyfried commentedon Apr 24, 2017
@michaelwoerister
Once #40939 lands it should be simple.
rushmorem commentedon Apr 26, 2017
I'm getting this warning too when using proc-macro-hack (cc @dtolnay). Is there any way to suppress it?
seanmonstar commentedon Jun 7, 2017
If it will take a while to fix this, it would be nice to at least be able to suppress the warning.
michaelwoerister commentedon Jun 8, 2017
@jseyfried Is there an ETA for #40939?
michaelwoerister commentedon Jul 7, 2017
Now that #40939 has landed, will you look into a fix, @jseyfried?
jseyfried commentedon Jul 10, 2017
@michaelwoerister Sure, I still think #40946 (comment) is the best fix; I'll implement this week.
michaelwoerister commentedon Jul 11, 2017
Thanks a lot, @jseyfried ❤️
Fix "Quasi-quoting is inefficient" warning in incremental rustbuild.
Rollup merge of rust-lang#43292 - kennytm:fix-quasi-quoting-warning-i…
nikomatsakis commentedon Aug 16, 2017
@jseyfried any updates on status of this?
alexcrichton commentedon Sep 15, 2017
I've made a PR for this at #44601, although @jseyfried if that's not at all what you were thinking, just let me know!
rustc: Forbid interpolated tokens in the HIR
Auto merge of #44601 - alexcrichton:lower-attributes-in-hir, r=nrc