mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-03 18:43:38 +00:00
ast_passes/validation: update attribute macro example
This commit is contained in:
parent
356027b709
commit
0e3521605d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user