|  | 
| 4 | 4 | //! AST visitor. Also see `rustc_session::lint::builtin`, which contains the | 
| 5 | 5 | //! definitions of lints that are emitted directly inside the main compiler. | 
| 6 | 6 | //! | 
| 7 |  | -//! To add a new lint to rustc, declare it here using `declare_lint!()`. | 
|  | 7 | +//! To add a new lint to rustc, declare it here using [`declare_lint!`]. | 
| 8 | 8 | //! Then add code to emit the new lint in the appropriate circumstances. | 
| 9 |  | -//! You can do that in an existing `LintPass` if it makes sense, or in a | 
| 10 |  | -//! new `LintPass`, or using `Session::add_lint` elsewhere in the | 
| 11 |  | -//! compiler. Only do the latter if the check can't be written cleanly as a | 
| 12 |  | -//! `LintPass` (also, note that such lints will need to be defined in | 
| 13 |  | -//! `rustc_session::lint::builtin`, not here). | 
| 14 | 9 | //! | 
| 15 |  | -//! If you define a new `EarlyLintPass`, you will also need to add it to the | 
| 16 |  | -//! `add_early_builtin!` or `add_early_builtin_with_new!` invocation in | 
| 17 |  | -//! `lib.rs`. Use the former for unit-like structs and the latter for structs | 
| 18 |  | -//! with a `pub fn new()`. | 
|  | 10 | +//! If you define a new [`EarlyLintPass`], you will also need to add it to the | 
|  | 11 | +//! [`crate::early_lint_methods!`] invocation in `lib.rs`. | 
| 19 | 12 | //! | 
| 20 |  | -//! If you define a new `LateLintPass`, you will also need to add it to the | 
| 21 |  | -//! `late_lint_methods!` invocation in `lib.rs`. | 
|  | 13 | +//! If you define a new [`LateLintPass`], you will also need to add it to the | 
|  | 14 | +//! [`crate::late_lint_methods!`] invocation in `lib.rs`. | 
| 22 | 15 | 
 | 
| 23 | 16 | use std::fmt::Write; | 
| 24 | 17 | 
 | 
|  | 
0 commit comments