Skip to content

Commit 0e35216

Browse files
committed
ast_passes/validation: update attribute macro example
1 parent 356027b commit 0e35216

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

compiler/rustc_ast_passes/src/ast_validation.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
//!
33
//! This pass intends to check that the constructed AST is *syntactically valid* to allow the rest
44
//! of the compiler to assume that the AST is valid. These checks cannot be performed during parsing
5-
//! because attribute macros are allowed to accept certain pieces of invalid syntax such as `async
6-
//! fn` within a trait (before async-fn-in-trait was introduced).
5+
//! because attribute macros are allowed to accept certain pieces of invalid syntax such as a
6+
//! function without body outside of a trait definition:
7+
//!
8+
//! ```ignore (illustrative)
9+
//! #[my_attribute]
10+
//! mod foo {
11+
//! fn missing_body();
12+
//! }
13+
//! ```
714
//!
815
//! These checks are run post-expansion, after AST is frozen, to be able to check for erroneous
916
//! constructions produced by proc macros. This pass is only intended for simple checks that do not

0 commit comments

Comments
 (0)