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§
Enums§
- Self
Semantic 🔒 - Is
self
allowed semantically as the first parameter in anFnDecl
? - Trait
OrTrait 🔒Impl
Functions§
- check_
crate - deny_
equality_ 🔒constraints - 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. - validate_
generic_ 🔒param_ order - Checks that generic parameters are in the correct order,
which is lifetimes, then types and then consts. (
<'a, T, const N: usize>
)