Skip to content

Commit

Permalink
ast_passes/validation: update attribute macro example
Browse files Browse the repository at this point in the history
  • Loading branch information
jieyouxu committed Apr 17, 2024
1 parent 356027b commit 0e35216
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
//!
//! This pass intends to check that the constructed AST is *syntactically valid* to allow the rest
//! of the compiler to assume that the AST is valid. These checks cannot be performed during parsing
//! because attribute macros are allowed to accept certain pieces of invalid syntax such as `async
//! fn` within a trait (before async-fn-in-trait was introduced).
//! because attribute macros are allowed to accept certain pieces of invalid syntax such as a
//! function without body outside of a trait definition:
//!
//! ```ignore (illustrative)
//! #[my_attribute]
//! mod foo {
//! fn missing_body();
//! }
//! ```
//!
//! These checks are run post-expansion, after AST is frozen, to be able to check for erroneous
//! constructions produced by proc macros. This pass is only intended for simple checks that do not
Expand Down

0 comments on commit 0e35216

Please sign in to comment.