Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6db5712

Browse files
authoredNov 6, 2024
Unrolled build for rust-lang#132637
Rollup merge of rust-lang#132637 - blyxyas:lint-less-passes, r=flip1995 Do not filter empty lint passes & re-do CTFE pass Some structs implement `LintPass` without having a `Lint` associated with them rust-lang#125116 broke that behaviour by filtering them out. This PR ensures that lintless passes are not filtered out.
2 parents bc5cf99 + 2eac3c0 commit 6db5712

File tree

2 files changed

+9
-19
lines changed
  • compiler/rustc_lint/src
  • src/tools/clippy/clippy_lints/src

2 files changed

+9
-19
lines changed
 

‎compiler/rustc_lint/src/late.rs

+3
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
422422
.into_iter()
423423
.filter(|pass| {
424424
let lints = (**pass).get_lints();
425+
// Lintless passes are always in
426+
lints.is_empty() ||
427+
// If the pass doesn't have a single needed lint, omit it
425428
!lints.iter().all(|lint| lints_that_dont_need_to_run.contains(&LintId::of(lint)))
426429
})
427430
.collect();

‎src/tools/clippy/clippy_lints/src/ctfe.rs

+6-19
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
use rustc_hir::def_id::LocalDefId;
22
use rustc_hir::intravisit::FnKind;
33
use rustc_hir::{Body, FnDecl};
4-
use rustc_lint::Level::Deny;
5-
use rustc_lint::{LateContext, LateLintPass, Lint};
4+
use rustc_lint::{LateContext, LateLintPass};
65
use rustc_session::declare_lint_pass;
76
use rustc_span::Span;
87

9-
/// Ensures that Constant-time Function Evaluation is being done (specifically, MIR lint passes).
10-
/// As Clippy deactivates codegen, this lint ensures that CTFE (used in hard errors) is still ran.
11-
pub static CLIPPY_CTFE: &Lint = &Lint {
12-
name: &"clippy::CLIPPY_CTFE",
13-
default_level: Deny,
14-
desc: "Ensure CTFE is being made",
15-
edition_lint_opts: None,
16-
report_in_external_macro: true,
17-
future_incompatible: None,
18-
is_externally_loaded: true,
19-
crate_level_only: false,
20-
eval_always: true,
21-
..Lint::default_fields_for_macro()
22-
};
238

24-
// No static CLIPPY_CTFE_INFO because we want this lint to be invisible
25-
26-
declare_lint_pass! { ClippyCtfe => [CLIPPY_CTFE] }
9+
declare_lint_pass! {
10+
/// Ensures that Constant-time Function Evaluation is being done (specifically, MIR lint passes).
11+
/// As Clippy deactivates codegen, this lint ensures that CTFE (used in hard errors) is still ran.
12+
ClippyCtfe => []
13+
}
2714

2815
impl<'tcx> LateLintPass<'tcx> for ClippyCtfe {
2916
fn check_fn(

0 commit comments

Comments
 (0)
Failed to load comments.