|
8 | 8 | // option. This file may not be copied, modified, or distributed |
9 | 9 | // except according to those terms. |
10 | 10 |
|
11 | | -//! Lints built in to rustc. |
| 11 | +//! Lints in the Rust compiler. |
12 | 12 | //! |
13 | | -//! This is a sibling of `lint::context` in order to ensure that |
14 | | -//! lints implemented here use the same public API as lint plugins. |
| 13 | +//! This contains lints which can feasibly be implemented as their own |
| 14 | +//! AST visitor. Also see `rustc::lint::builtin`, which contains the |
| 15 | +//! definitions of lints that are emitted directly inside the main |
| 16 | +//! compiler. |
15 | 17 | //! |
16 | 18 | //! To add a new lint to rustc, declare it here using `declare_lint!()`. |
17 | 19 | //! Then add code to emit the new lint in the appropriate circumstances. |
18 | | -//! You can do that in an existing `LintPass` if it makes sense, or in |
19 | | -//! a new `LintPass`, or using `Session::add_lint` elsewhere in the |
20 | | -//! compiler. Only do the latter if the check can't be written cleanly |
21 | | -//! as a `LintPass`. |
| 20 | +//! You can do that in an existing `LintPass` if it makes sense, or in a |
| 21 | +//! new `LintPass`, or using `Session::add_lint` elsewhere in the |
| 22 | +//! compiler. Only do the latter if the check can't be written cleanly as a |
| 23 | +//! `LintPass` (also, note that such lints will need to be defined in |
| 24 | +//! `rustc::lint::builtin`, not here). |
22 | 25 | //! |
23 | 26 | //! If you define a new `LintPass`, you will also need to add it to the |
24 | | -//! `add_builtin!` or `add_builtin_with_new!` invocation in `context.rs`. |
| 27 | +//! `add_builtin!` or `add_builtin_with_new!` invocation in `lib.rs`. |
25 | 28 | //! Use the former for unit-like structs and the latter for structs with |
26 | 29 | //! a `pub fn new()`. |
27 | 30 |
|
|
0 commit comments