Trait rustc_typeck::lint::LintPassUnstable
[-] [+]
[src]
pub trait LintPass { fn get_lints(&self) -> &'static [&'static &'static Lint]; fn check_crate(&mut self, &Context, &Crate) { ... } fn check_ident(&mut self, &Context, Span, Ident) { ... } fn check_mod(&mut self, &Context, &Mod, Span, u32) { ... } fn check_foreign_item(&mut self, &Context, &ForeignItem) { ... } fn check_item(&mut self, &Context, &Item) { ... } fn check_local(&mut self, &Context, &Local) { ... } fn check_block(&mut self, &Context, &Block) { ... } fn check_stmt(&mut self, &Context, &Spanned<Stmt_>) { ... } fn check_arm(&mut self, &Context, &Arm) { ... } fn check_pat(&mut self, &Context, &Pat) { ... } fn check_decl(&mut self, &Context, &Spanned<Decl_>) { ... } fn check_expr(&mut self, &Context, &Expr) { ... } fn check_expr_post(&mut self, &Context, &Expr) { ... } fn check_ty(&mut self, &Context, &Ty) { ... } fn check_generics(&mut self, &Context, &Generics) { ... } fn check_fn(&mut self, &Context, FnKind, &FnDecl, &Block, Span, u32) { ... } fn check_trait_item(&mut self, &Context, &TraitItem) { ... } fn check_impl_item(&mut self, &Context, &ImplItem) { ... } fn check_struct_def(&mut self, &Context, &StructDef, Ident, &Generics, u32) { ... } fn check_struct_def_post(&mut self, &Context, &StructDef, Ident, &Generics, u32) { ... } fn check_struct_field(&mut self, &Context, &Spanned<StructField_>) { ... } fn check_variant(&mut self, &Context, &Spanned<Variant_>, &Generics) { ... } fn check_variant_post(&mut self, &Context, &Spanned<Variant_>, &Generics) { ... } fn check_opt_lifetime_ref(&mut self, &Context, Span, &Option<Lifetime>) { ... } fn check_lifetime_ref(&mut self, &Context, &Lifetime) { ... } fn check_lifetime_def(&mut self, &Context, &LifetimeDef) { ... } fn check_explicit_self(&mut self, &Context, &Spanned<ExplicitSelf_>) { ... } fn check_mac(&mut self, &Context, &Spanned<Mac_>) { ... } fn check_path(&mut self, &Context, &Path, u32) { ... } fn check_attribute(&mut self, &Context, &Spanned<Attribute_>) { ... } fn enter_lint_attrs(&mut self, &Context, &[Spanned<Attribute_>]) { ... } fn exit_lint_attrs(&mut self, &Context, &[Spanned<Attribute_>]) { ... } }
Trait for types providing lint checks.
Each check
method checks a single syntax node, and should not
invoke methods recursively (unlike Visitor
). By default they
do nothing.
Required Methods
fn get_lints(&self) -> &'static [&'static &'static Lint]
Get descriptions of the lints this LintPass
object can emit.
NB: there is no enforcement that the object only emits lints it registered.
And some rustc
internal LintPass
es register lints to be emitted by other
parts of the compiler. If you want enforced access restrictions for your
Lint
, make it a private static
item in its own module.
Provided Methods
fn check_crate(&mut self, &Context, &Crate)
fn check_ident(&mut self, &Context, Span, Ident)
fn check_mod(&mut self, &Context, &Mod, Span, u32)
fn check_foreign_item(&mut self, &Context, &ForeignItem)
fn check_item(&mut self, &Context, &Item)
fn check_local(&mut self, &Context, &Local)
fn check_block(&mut self, &Context, &Block)
fn check_stmt(&mut self, &Context, &Spanned<Stmt_>)
fn check_arm(&mut self, &Context, &Arm)
fn check_pat(&mut self, &Context, &Pat)
fn check_decl(&mut self, &Context, &Spanned<Decl_>)
fn check_expr(&mut self, &Context, &Expr)
fn check_expr_post(&mut self, &Context, &Expr)
fn check_ty(&mut self, &Context, &Ty)
fn check_generics(&mut self, &Context, &Generics)
fn check_fn(&mut self, &Context, FnKind, &FnDecl, &Block, Span, u32)
fn check_trait_item(&mut self, &Context, &TraitItem)
fn check_impl_item(&mut self, &Context, &ImplItem)
fn check_struct_def(&mut self, &Context, &StructDef, Ident, &Generics, u32)
fn check_struct_def_post(&mut self, &Context, &StructDef, Ident, &Generics, u32)
fn check_struct_field(&mut self, &Context, &Spanned<StructField_>)
fn check_variant(&mut self, &Context, &Spanned<Variant_>, &Generics)
fn check_variant_post(&mut self, &Context, &Spanned<Variant_>, &Generics)
fn check_opt_lifetime_ref(&mut self, &Context, Span, &Option<Lifetime>)
fn check_lifetime_ref(&mut self, &Context, &Lifetime)
fn check_lifetime_def(&mut self, &Context, &LifetimeDef)
fn check_explicit_self(&mut self, &Context, &Spanned<ExplicitSelf_>)
fn check_mac(&mut self, &Context, &Spanned<Mac_>)
fn check_path(&mut self, &Context, &Path, u32)
fn check_attribute(&mut self, &Context, &Spanned<Attribute_>)
fn enter_lint_attrs(&mut self, &Context, &[Spanned<Attribute_>])
Called when entering a syntax node that can have lint attributes such
as #[allow(...)]
. Called with all the attributes of that node.
fn exit_lint_attrs(&mut self, &Context, &[Spanned<Attribute_>])
Counterpart to enter_lint_attrs
.
Implementors
impl LintPass for HardwiredLints
impl LintPass for GatherNodeLevels