-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-pluginsArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlA-syntaxextArea: Syntax extensionsArea: Syntax extensionsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
There's a variety of invariants in the AST, e.g. the Expr
in a PatLit
should (AFAIK) be an ExprLit
, and the Option<Expr>
in an ExprIf
should be either a ExprBlock
or ExprIf
. It would be convenient if the compiler either had a AST validation pass run after macro expansion (could include verifying that there are no macros left in the AST), a validation function called on the resulting AST after each macro is expanded or just a series of manual functions that syntax extension authors can call on the code they generate to help debugging.
(The first two should, IMO, be opt-in, since most users won't want to be wasting the compilation time on something that should never trigger if they're not writing their own macros.)
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-pluginsArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.htmlA-syntaxextArea: Syntax extensionsArea: Syntax extensionsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.