Module rustc::lint::context [−][src]
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Implementation of lint checking.
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.
Re-exports
use self::TargetLint::*; |
use std::slice; |
use rustc_data_structures::sync::RwLock; |
use rustc_data_structures::sync::ReadGuard; |
use lint::EarlyLintPassObject; |
use lint::LateLintPassObject; |
use lint::Level; |
use lint::Lint; |
use lint::LintId; |
use lint::LintPass; |
use lint::LintBuffer; |
use lint::builtin::BuiltinLintDiagnostics; |
use lint::levels::LintLevelSets; |
use lint::levels::LintLevelsBuilder; |
use middle::privacy::AccessLevels; |
use rustc_serialize::Decoder; |
use rustc_serialize::Decodable; |
use rustc_serialize::Encoder; |
use rustc_serialize::Encodable; |
use session::config; |
use session::early_error; |
use session::Session; |
use ty; |
use ty::TyCtxt; |
use ty::Ty; |
use ty::layout::LayoutError; |
use ty::layout::LayoutOf; |
use ty::layout::TyLayout; |
use util::nodemap::FxHashMap; |
use util::nodemap::FxHashMap; |
use std::default::Default as StdDefault; |
use syntax::ast; |
use syntax::edition; |
use syntax_pos::MultiSpan; |
use syntax_pos::Span; |
use errors::DiagnosticBuilder; |
use hir; |
use hir::def_id::LOCAL_CRATE; |
use hir::intravisit as hir_visit; |
use syntax::visit as ast_visit; |
Structs
BufferedEarlyLint |
[ Experimental ] Lints that are buffered up early on in the |
EarlyContext |
[ Experimental ] Context for lint checking of the AST, after expansion, before lowering to HIR. |
FutureIncompatibleInfo |
[ Experimental ] Extra information for a future incompatibility lint. See the call
to |
LateContext |
[ Experimental ] Context for lint checking after type checking. |
LintSession |
[ Experimental ]
|
LintStore |
[ Experimental ] Information about the registered lints. |
Enums
CheckLintNameResult |
[ Experimental ]
|
FindLintError |
[ Experimental ]
|
TargetLint |
[ Experimental ] The target of the |
Traits
LintContext |
[ Experimental ]
|
LintPassObject |
[ Experimental ]
|
Functions
check_ast_crate |
[ Experimental ]
|
check_crate |
[ Experimental ] Perform lint checking on a crate. |