Module rustc_ast_passes::ast_validation
source Β· Expand description
Validate AST before lowering it to HIR.
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 a function without body outside of a trait definition:
β
#[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 require name resolution or type checking, or other kinds of complex analysis.
Structs§
- AstValidator π
Enums§
- Self
Semantic πIsself
allowed semantically as the first parameter in anFnDecl
? - Trait
OrTrait πImpl
Functions§
- When encountering an equality constraint in a
where
clause, emit an error. If the code seems like itβs setting an associated type, provide an appropriate suggestion. - Checks that generic parameters are in the correct order, which is lifetimes, then types and then consts. (
<'a, T, const N: usize>
)