about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com>2024-04-17 19:37:27 +0000
committer许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com>2024-04-17 19:38:29 +0000
commit0e3521605dff967199347565dde4d4daeb36fe6d (patch)
tree966733bb4bb0792ed18e5ae2643ce9ed6c3280a4
parent356027b7097abb90538a5794da30af16326518d9 (diff)
downloadrust-0e3521605dff967199347565dde4d4daeb36fe6d.tar.gz
rust-0e3521605dff967199347565dde4d4daeb36fe6d.zip
ast_passes/validation: update attribute macro example
-rw-r--r--compiler/rustc_ast_passes/src/ast_validation.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs
index 0592837e42c..eadfd3b98e2 100644
--- a/compiler/rustc_ast_passes/src/ast_validation.rs
+++ b/compiler/rustc_ast_passes/src/ast_validation.rs
@@ -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