Clean up some comments on lint implementation
This commit is contained in:
parent
de7cef75be
commit
924ded6b72
5 changed files with 18 additions and 66 deletions
|
@ -4,21 +4,14 @@
|
|||
//! AST visitor. Also see `rustc_session::lint::builtin`, which contains the
|
||||
//! definitions of lints that are emitted directly inside the main compiler.
|
||||
//!
|
||||
//! To add a new lint to rustc, declare it here using `declare_lint!()`.
|
||||
//! To add a new lint to rustc, declare it here using [`declare_lint!`].
|
||||
//! Then add code to emit the new lint in the appropriate circumstances.
|
||||
//! You can do that in an existing `LintPass` if it makes sense, or in a
|
||||
//! new `LintPass`, or using `Session::add_lint` elsewhere in the
|
||||
//! compiler. Only do the latter if the check can't be written cleanly as a
|
||||
//! `LintPass` (also, note that such lints will need to be defined in
|
||||
//! `rustc_session::lint::builtin`, not here).
|
||||
//!
|
||||
//! If you define a new `EarlyLintPass`, you will also need to add it to the
|
||||
//! `add_early_builtin!` or `add_early_builtin_with_new!` invocation in
|
||||
//! `lib.rs`. Use the former for unit-like structs and the latter for structs
|
||||
//! with a `pub fn new()`.
|
||||
//! If you define a new [`EarlyLintPass`], you will also need to add it to the
|
||||
//! [`crate::early_lint_methods!`] invocation in `lib.rs`.
|
||||
//!
|
||||
//! If you define a new `LateLintPass`, you will also need to add it to the
|
||||
//! `late_lint_methods!` invocation in `lib.rs`.
|
||||
//! If you define a new [`LateLintPass`], you will also need to add it to the
|
||||
//! [`crate::late_lint_methods!`] invocation in `lib.rs`.
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue