-
Notifications
You must be signed in to change notification settings - Fork 13.3k
feature_gate::MacroVisitor
misses macro invocations nested in macro invocations
#22234
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
Comments
(investigating; I thought this would be a simple matter of calling |
also: Nominating, since this strikes me as a hole in our feature checking. |
(I imagine we could just walk the token tree looking for occurrences of ` '!'`` and then assume that might be a macro invocation. Where would that break down, hmm...) |
Another potential approach to handling these scenarios could be to have the expansions inject a token that is effectively a no-op into the generated AST that marks it as being generated via |
feature_gate::MacroVisitor
misses arguments on macro invocationsfeature_gate::MacroVisitor
misses macro invocations nested in macro invocations
1.0 polish issue, P-high. |
The other cases: `concat_idents!`, `log_syntax!`, and `trace_macros!`, (these macros, with `asm!`, are handled (eagerly) in feature_gate.rs).
…-expansion, r=huonw Pass features along during expansion Use the set of passed features to detect uses of feature-gated macros without the corresponding feature enabled. Fix rust-lang#22234. ---- Also, the framework this add (passing along a reference to the features in the expansion context) is a necessary precursor for landing a properly feature-gated desugaring-based overloaded-`box` and placement-`in` (rust-lang#22181). ---- This is fixing a bug, but since there might be code out there that is unknowingly taking advantage of that bug, I feel obligated to mark this as a: [breaking-change]
Today, this program is correctly rejected:
due to a missing
#![feature(asm)]
Unfortunately, this variant program is accepted by the compiler:
The reason (I think) is that the
fn visit_mac
infeature_gate::MacroVisitor
needs to recursively invoke the visitor on the expression inputs to the macro.The text was updated successfully, but these errors were encountered: