Skip to content

Commit 0f0252c

Browse files
committed
Remove dead lint code.
1 parent fedf954 commit 0f0252c

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

compiler/rustc_lint/src/context.rs

+5-27
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,6 @@ pub struct LateContext<'tcx> {
497497
/// Items accessible from the crate being checked.
498498
pub effective_visibilities: &'tcx EffectiveVisibilities,
499499

500-
/// The store of registered lints and the lint levels.
501-
pub lint_store: &'tcx LintStore,
502-
503500
pub last_node_with_lint_attrs: hir::HirId,
504501

505502
/// Generic type parameters in scope for the item we are in.
@@ -515,21 +512,14 @@ pub struct EarlyContext<'a> {
515512
pub buffered: LintBuffer,
516513
}
517514

518-
pub trait LintPassObject: Sized {}
519-
520-
impl LintPassObject for EarlyLintPassObject {}
521-
522-
impl LintPassObject for LateLintPassObject<'_> {}
523-
524-
pub trait LintContext: Sized {
525-
type PassObject: LintPassObject;
526-
515+
pub trait LintContext {
527516
fn sess(&self) -> &Session;
528-
fn lints(&self) -> &LintStore;
529517

530-
/// Emit a lint at the appropriate level, with an optional associated span and an existing diagnostic.
518+
/// Emit a lint at the appropriate level, with an optional associated span and an existing
519+
/// diagnostic.
531520
///
532-
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed explanation.
521+
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed
522+
/// explanation.
533523
///
534524
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
535525
#[rustc_lint_diagnostics]
@@ -1059,17 +1049,11 @@ impl<'a> EarlyContext<'a> {
10591049
}
10601050

10611051
impl<'tcx> LintContext for LateContext<'tcx> {
1062-
type PassObject = LateLintPassObject<'tcx>;
1063-
10641052
/// Gets the overall compiler `Session` object.
10651053
fn sess(&self) -> &Session {
10661054
&self.tcx.sess
10671055
}
10681056

1069-
fn lints(&self) -> &LintStore {
1070-
&*self.lint_store
1071-
}
1072-
10731057
#[rustc_lint_diagnostics]
10741058
fn lookup<S: Into<MultiSpan>>(
10751059
&self,
@@ -1094,17 +1078,11 @@ impl<'tcx> LintContext for LateContext<'tcx> {
10941078
}
10951079

10961080
impl LintContext for EarlyContext<'_> {
1097-
type PassObject = EarlyLintPassObject;
1098-
10991081
/// Gets the overall compiler `Session` object.
11001082
fn sess(&self) -> &Session {
11011083
&self.builder.sess()
11021084
}
11031085

1104-
fn lints(&self) -> &LintStore {
1105-
self.builder.lint_store()
1106-
}
1107-
11081086
#[rustc_lint_diagnostics]
11091087
fn lookup<S: Into<MultiSpan>>(
11101088
&self,

compiler/rustc_lint/src/late.rs

-2
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
353353
cached_typeck_results: Cell::new(None),
354354
param_env: ty::ParamEnv::empty(),
355355
effective_visibilities: &tcx.effective_visibilities(()),
356-
lint_store: unerased_lint_store(tcx),
357356
last_node_with_lint_attrs: tcx.hir().local_def_id_to_hir_id(module_def_id),
358357
generics: None,
359358
only_module: true,
@@ -412,7 +411,6 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
412411
cached_typeck_results: Cell::new(None),
413412
param_env: ty::ParamEnv::empty(),
414413
effective_visibilities: &tcx.effective_visibilities(()),
415-
lint_store: unerased_lint_store(tcx),
416414
last_node_with_lint_attrs: hir::CRATE_HIR_ID,
417415
generics: None,
418416
only_module: false,

compiler/rustc_lint/src/levels.rs

-4
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
548548
self.features
549549
}
550550

551-
pub(crate) fn lint_store(&self) -> &LintStore {
552-
self.store
553-
}
554-
555551
fn current_specs(&self) -> &FxHashMap<LintId, LevelAndSource> {
556552
self.provider.current_specs()
557553
}

0 commit comments

Comments
 (0)