Skip to content

Commit b592359

Browse files
committedJan 11, 2020
lints: move a comment
1 parent f58db20 commit b592359

File tree

2 files changed

+21
-25
lines changed

2 files changed

+21
-25
lines changed
 

‎src/librustc_lint/lib.rs

+21-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
//! # Lints in the Rust compiler
1+
//! Lints, aka compiler warnings.
22
//!
3-
//! This currently only contains the definitions and implementations
4-
//! of most of the lints that `rustc` supports directly, it does not
5-
//! contain the infrastructure for defining/registering lints. That is
6-
//! available in `rustc::lint` and `rustc_driver::plugin` respectively.
3+
//! A 'lint' check is a kind of miscellaneous constraint that a user _might_
4+
//! want to enforce, but might reasonably want to permit as well, on a
5+
//! module-by-module basis. They contrast with static constraints enforced by
6+
//! other phases of the compiler, which are generally required to hold in order
7+
//! to compile the program at all.
8+
//!
9+
//! Most lints can be written as `LintPass` instances. These run after
10+
//! all other analyses. The `LintPass`es built into rustc are defined
11+
//! within `rustc_session::lint::builtin`,
12+
//! which has further comments on how to add such a lint.
13+
//! rustc can also load user-defined lint plugins via the plugin mechanism.
14+
//!
15+
//! Some of rustc's lints are defined elsewhere in the compiler and work by
16+
//! calling `add_lint()` on the overall `Session` object. This works when
17+
//! it happens before the main lint pass, which emits the lints stored by
18+
//! `add_lint()`. To emit lints after the main lint pass (from codegen, for
19+
//! example) requires more effort. See `emit_lint` and `GatherNodeLevels`
20+
//! in `context.rs`.
21+
//!
22+
//! Some code also exists in `rustc_session::lint`, `rustc::lint`.
723
//!
824
//! ## Note
925
//!

‎src/librustc_lint/passes.rs

-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
//! Lints, aka compiler warnings.
2-
//!
3-
//! A 'lint' check is a kind of miscellaneous constraint that a user _might_
4-
//! want to enforce, but might reasonably want to permit as well, on a
5-
//! module-by-module basis. They contrast with static constraints enforced by
6-
//! other phases of the compiler, which are generally required to hold in order
7-
//! to compile the program at all.
8-
//!
9-
//! Most lints can be written as `LintPass` instances. These run after
10-
//! all other analyses. The `LintPass`es built into rustc are defined
11-
//! within `builtin.rs`, which has further comments on how to add such a lint.
12-
//! rustc can also load user-defined lint plugins via the plugin mechanism.
13-
//!
14-
//! Some of rustc's lints are defined elsewhere in the compiler and work by
15-
//! calling `add_lint()` on the overall `Session` object. This works when
16-
//! it happens before the main lint pass, which emits the lints stored by
17-
//! `add_lint()`. To emit lints after the main lint pass (from codegen, for
18-
//! example) requires more effort. See `emit_lint` and `GatherNodeLevels`
19-
//! in `context.rs`.
20-
211
use crate::context::{EarlyContext, LateContext};
222

233
use rustc_data_structures::sync;

0 commit comments

Comments
 (0)
Please sign in to comment.