ast_passes/validation: update attribute macro example
This commit is contained in:
parent
356027b709
commit
0e3521605d
1 changed files with 9 additions and 2 deletions
|
@ -2,8 +2,15 @@
|
||||||
//!
|
//!
|
||||||
//! This pass intends to check that the constructed AST is *syntactically valid* to allow the rest
|
//! 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
|
//! 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
|
//! because attribute macros are allowed to accept certain pieces of invalid syntax such as a
|
||||||
//! fn` within a trait (before async-fn-in-trait was introduced).
|
//! 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
|
//! 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
|
//! constructions produced by proc macros. This pass is only intended for simple checks that do not
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue