Skip to content

Commit 47f8ea4

Browse files
committed
room to breath
1 parent f6f1375 commit 47f8ea4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/diagnostics/lintstore.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Lints
2+
23
This page documents some of the machinery around lint registration and how we
34
run lints in the compiler.
45

@@ -8,6 +9,7 @@ everything rotates. It's not available during the early parts of compilation
89
lints, which can only happen after plugin registration.
910

1011
## Lints vs. lint passes
12+
1113
There are two parts to the linting mechanism within the compiler: lints and
1214
lint passes. Unfortunately, a lot of the documentation we have refers to both
1315
of these as just "lints."
@@ -34,6 +36,7 @@ lints are emitted as part of other work (e.g., type checking, etc.).
3436
## Registration
3537

3638
### High-level overview
39+
3740
In [`rustc_interface::register_plugins`] the [`LintStore`] is created and all
3841
lints are registered.
3942

@@ -61,6 +64,7 @@ then invoke the lint pass methods. The lint pass methods take `&mut self` so
6164
they can keep track of state internally.
6265

6366
#### Internal lints
67+
6468
These are lints used just by the compiler or plugins like `clippy`. They can be
6569
found in `rustc_lint::internal`.
6670

@@ -73,6 +77,7 @@ function which is called when constructing a new lint store inside
7377
[`rustc_lint::new_lint_store`].
7478

7579
### Builtin Lints
80+
7681
These are primarily described in two places: `rustc_session::lint::builtin` and
7782
`rustc_lint::builtin`. Often the first provides the definitions for the lints
7883
themselves, and the latter provides the lint pass definitions (and
@@ -83,6 +88,7 @@ function. Just like with internal lints, this happens inside of
8388
[`rustc_lint::new_lint_store`].
8489

8590
#### Plugin lints
91+
8692
This is one of the primary use cases remaining for plugins/drivers. Plugins are
8793
given access to the mutable `LintStore` during registration (which happens
8894
inside of [`rustc_interface::register_plugins`]) and they can call any
@@ -94,6 +100,7 @@ diagnostics and help text; otherwise plugin lints are mostly just as first
94100
class as rustc builtin lints.
95101

96102
#### Driver lints
103+
97104
These are the lints provided by drivers via the `rustc_interface::Config`
98105
[`register_lints`] field, which is a callback. Drivers should, if finding it
99106
already set, call the function currently set within the callback they add. The
@@ -102,6 +109,7 @@ best way for drivers to get access to this is by overriding the
102109
structure.
103110

104111
## Compiler lint passes are combined into one pass
112+
105113
Within the compiler, for performance reasons, we usually do not register dozens
106114
of lint passes. Instead, we have a single lint pass of each variety (e.g.,
107115
`BuiltinCombinedModuleLateLintPass`) which will internally call all of the

0 commit comments

Comments
 (0)