Skip to content

Commit 65b6ac9

Browse files
Rollup merge of #153820 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Rename `opt_span_diag_lint` into `opt_span_lint` and remove `emit_diag_lint` Part of #153099. Should be the last naming cleanup hopefully. :) r? @JonathanBrouwer
2 parents 341b42a + 9d45c1e commit 65b6ac9

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

compiler/rustc_lint/src/context.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ pub trait LintContext {
516516
///
517517
/// [`emit_lint_base`]: rustc_middle::lint::emit_lint_base#decorate-signature
518518
#[track_caller]
519-
fn opt_span_diag_lint<S: Into<MultiSpan>>(
519+
fn opt_span_lint<S: Into<MultiSpan>>(
520520
&self,
521521
lint: &'static Lint,
522522
span: Option<S>,
@@ -532,13 +532,7 @@ pub trait LintContext {
532532
span: S,
533533
decorator: impl for<'a> Diagnostic<'a, ()>,
534534
) {
535-
self.opt_span_diag_lint(lint, Some(span), decorator);
536-
}
537-
538-
/// Emit a lint from a lint struct (some type that implements `Diagnostic`, typically
539-
/// generated by `#[derive(Diagnostic)]`).
540-
fn emit_diag_lint(&self, lint: &'static Lint, decorator: impl for<'a> Diagnostic<'a, ()>) {
541-
self.opt_span_diag_lint(lint, None as Option<Span>, decorator);
535+
self.opt_span_lint(lint, Some(span), decorator);
542536
}
543537

544538
/// This returns the lint level for the given lint at the current location.
@@ -594,7 +588,7 @@ impl<'tcx> LintContext for LateContext<'tcx> {
594588
self.tcx.sess
595589
}
596590

597-
fn opt_span_diag_lint<S: Into<MultiSpan>>(
591+
fn opt_span_lint<S: Into<MultiSpan>>(
598592
&self,
599593
lint: &'static Lint,
600594
span: Option<S>,
@@ -619,13 +613,13 @@ impl LintContext for EarlyContext<'_> {
619613
self.builder.sess()
620614
}
621615

622-
fn opt_span_diag_lint<S: Into<MultiSpan>>(
616+
fn opt_span_lint<S: Into<MultiSpan>>(
623617
&self,
624618
lint: &'static Lint,
625619
span: Option<S>,
626620
decorator: impl for<'a> Diagnostic<'a, ()>,
627621
) {
628-
self.builder.opt_span_diag_lint(lint, span.map(|s| s.into()), decorator)
622+
self.builder.opt_span_lint(lint, span.map(|s| s.into()), decorator)
629623
}
630624

631625
fn get_lint_level(&self, lint: &'static Lint) -> LevelAndSource {

compiler/rustc_lint/src/early.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'ecx, 'tcx, T: EarlyLintPass> EarlyContextAndPass<'ecx, 'tcx, T> {
3939
let BufferedEarlyLint { span, node_id: _, lint_id, diagnostic } = early_lint;
4040
match diagnostic {
4141
DecorateDiagCompat::Builtin(b) => {
42-
self.context.opt_span_diag_lint(
42+
self.context.opt_span_lint(
4343
lint_id.lint,
4444
span,
4545
DecorateBuiltinLint {
@@ -50,7 +50,7 @@ impl<'ecx, 'tcx, T: EarlyLintPass> EarlyContextAndPass<'ecx, 'tcx, T> {
5050
);
5151
}
5252
DecorateDiagCompat::Dynamic(d) => {
53-
self.context.opt_span_diag_lint(lint_id.lint, span, d);
53+
self.context.opt_span_lint(lint_id.lint, span, d);
5454
}
5555
}
5656
}

compiler/rustc_lint/src/levels.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
10011001
/// Used to emit a lint-related diagnostic based on the current state of
10021002
/// this lint context.
10031003
#[track_caller]
1004-
pub(crate) fn opt_span_diag_lint(
1004+
pub(crate) fn opt_span_lint(
10051005
&self,
10061006
lint: &'static Lint,
10071007
span: Option<MultiSpan>,

0 commit comments

Comments
 (0)