Clean up some comments on lint implementation

This commit is contained in:
Eric Huss
2024-10-27 04:30:51 -07:00
parent de7cef75be
commit 924ded6b72
5 changed files with 18 additions and 66 deletions

View File

@@ -1,18 +1,7 @@
//! Implementation of lint checking.
//! Implementation of the late lint pass.
//!
//! The lint checking is mostly consolidated into one pass which runs
//! after all other analyses. Throughout compilation, lint warnings
//! can be added via the `add_lint` method on the Session structure. This
//! requires a span and an ID of the node that the lint is being added to. The
//! lint isn't actually emitted at that time because it is unknown what the
//! actual lint level at that location is.
//!
//! To actually emit lint warnings/errors, a separate pass is used.
//! A context keeps track of the current state of all lint levels.
//! Upon entering a node of the ast which can modify the lint settings, the
//! previous lint state is pushed onto a stack and the ast is then recursed
//! upon. As the ast is traversed, this keeps track of the current lint level
//! for all lint attributes.
//! The late lint pass Works on HIR nodes, towards the end of analysis (after
//! borrow checking, etc.). These lints have full type information available.
use std::any::Any;
use std::cell::Cell;