Skip to content

Commit ddb8bb1

Browse files
committed
WIP: skip early lints
1 parent 3c4fb44 commit ddb8bb1

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

compiler/rustc_lint/src/early.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,28 @@ pub fn check_ast_node<'a>(
380380
// `RuntimeCombinedEarlyLintPass`.
381381
let passes =
382382
if pre_expansion { &lint_store.pre_expansion_passes } else { &lint_store.early_passes };
383-
if passes.is_empty() {
384-
check_ast_node_inner(sess, tcx, check_node, context, builtin_lints);
385-
} else {
383+
// if passes.is_empty() {
384+
// let can_skip_lints = tcx
385+
// .map(|tcx| {
386+
// let dont_need_to_run = tcx.lints_that_dont_need_to_run(());
387+
// builtin_lints.get_lints().iter().all(|l| dont_need_to_run.contains(&LintId::of(l)))
388+
// })
389+
// .unwrap_or(false);
390+
// if true {
391+
// !can_skip_lints {
392+
// eprintln!("LINT: noskip");
393+
// check_ast_node_inner(sess, tcx, check_node, context, builtin_lints);
394+
// } else {
395+
// eprintln!("LINT: skip");
396+
// }
397+
// } else {
398+
if !passes.is_empty() {
386399
let mut passes: Vec<_> = passes.iter().map(|mk_pass| (mk_pass)()).collect();
387400
passes.push(Box::new(builtin_lints));
388401
let pass = RuntimeCombinedEarlyLintPass { passes: &mut passes[..] };
389402
check_ast_node_inner(sess, tcx, check_node, context, pass);
390403
}
404+
// }
391405
}
392406

393407
fn check_ast_node_inner<'a, T: EarlyLintPass>(

compiler/rustc_lint/src/passes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ macro_rules! declare_combined_early_lint_pass {
240240
#[allow(rustc::lint_pass_impl_without_macro)]
241241
impl $crate::LintPass for $name {
242242
fn name(&self) -> &'static str {
243-
panic!()
243+
stringify!($name)
244244
}
245245
fn get_lints(&self) -> LintVec {
246-
panic!()
246+
$name::get_lints()
247247
}
248248
}
249249
)

0 commit comments

Comments
 (0)