Skip to content

Commit 15a4c4f

Browse files
committed
Rename struct_lint_level as lint_level.
1 parent e164cf3 commit 15a4c4f

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

compiler/rustc_lint/src/context.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ pub trait LintContext {
530530
/// Emit a lint at the appropriate level, with an optional associated span and an existing
531531
/// diagnostic.
532532
///
533-
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
533+
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
534534
#[rustc_lint_diagnostics]
535535
fn span_lint_with_diagnostics(
536536
&self,
@@ -553,7 +553,7 @@ pub trait LintContext {
553553
// set the span in their `decorate` function (preferably using set_span).
554554
/// Emit a lint at the appropriate level, with an optional associated span.
555555
///
556-
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
556+
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
557557
#[rustc_lint_diagnostics]
558558
fn opt_span_lint<S: Into<MultiSpan>>(
559559
&self,
@@ -578,7 +578,7 @@ pub trait LintContext {
578578

579579
/// Emit a lint at the appropriate level, with an associated span.
580580
///
581-
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
581+
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
582582
#[rustc_lint_diagnostics]
583583
fn span_lint<S: Into<MultiSpan>>(
584584
&self,
@@ -600,7 +600,7 @@ pub trait LintContext {
600600

601601
/// Emit a lint at the appropriate level, with no associated span.
602602
///
603-
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
603+
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
604604
#[rustc_lint_diagnostics]
605605
fn lint(
606606
&self,

compiler/rustc_lint/src/levels.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use rustc_hir::HirId;
2424
use rustc_index::IndexVec;
2525
use rustc_middle::hir::nested_filter;
2626
use rustc_middle::lint::{
27-
reveal_actual_level, struct_lint_level, LevelAndSource, LintExpectation, LintLevelSource,
27+
lint_level, reveal_actual_level, LevelAndSource, LintExpectation, LintLevelSource,
2828
ShallowLintLevelMap,
2929
};
3030
use rustc_middle::query::Providers;
@@ -1062,7 +1062,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
10621062
if self.lint_added_lints {
10631063
let lint = builtin::UNKNOWN_LINTS;
10641064
let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS);
1065-
struct_lint_level(
1065+
lint_level(
10661066
self.sess,
10671067
lint,
10681068
level,
@@ -1096,7 +1096,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
10961096
/// Used to emit a lint-related diagnostic based on the current state of
10971097
/// this lint context.
10981098
///
1099-
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
1099+
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
11001100
#[rustc_lint_diagnostics]
11011101
#[track_caller]
11021102
pub(crate) fn opt_span_lint(
@@ -1107,7 +1107,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
11071107
decorate: impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>),
11081108
) {
11091109
let (level, src) = self.lint_level(lint);
1110-
struct_lint_level(self.sess, lint, level, src, span, msg, decorate)
1110+
lint_level(self.sess, lint, level, src, span, msg, decorate)
11111111
}
11121112

11131113
#[track_caller]
@@ -1118,15 +1118,15 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
11181118
decorate: impl for<'a> DecorateLint<'a, ()>,
11191119
) {
11201120
let (level, src) = self.lint_level(lint);
1121-
struct_lint_level(self.sess, lint, level, src, Some(span), decorate.msg(), |lint| {
1121+
lint_level(self.sess, lint, level, src, Some(span), decorate.msg(), |lint| {
11221122
decorate.decorate_lint(lint);
11231123
});
11241124
}
11251125

11261126
#[track_caller]
11271127
pub fn emit_lint(&self, lint: &'static Lint, decorate: impl for<'a> DecorateLint<'a, ()>) {
11281128
let (level, src) = self.lint_level(lint);
1129-
struct_lint_level(self.sess, lint, level, src, None, decorate.msg(), |lint| {
1129+
lint_level(self.sess, lint, level, src, None, decorate.msg(), |lint| {
11301130
decorate.decorate_lint(lint);
11311131
});
11321132
}

compiler/rustc_middle/src/lint.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ pub fn explain_lint_level_source(
258258
/// It is not intended to call `emit`/`cancel` on the `DiagnosticBuilder` passed
259259
/// in the `decorate` callback.
260260
#[track_caller]
261-
pub fn struct_lint_level(
261+
pub fn lint_level(
262262
sess: &Session,
263263
lint: &'static Lint,
264264
level: Level,
@@ -270,7 +270,7 @@ pub fn struct_lint_level(
270270
// Avoid codegen bloat from monomorphization by immediately doing dyn dispatch of `decorate` to
271271
// the "real" work.
272272
#[track_caller]
273-
fn struct_lint_level_impl(
273+
fn lint_level_impl(
274274
sess: &Session,
275275
lint: &'static Lint,
276276
level: Level,
@@ -399,7 +399,7 @@ pub fn struct_lint_level(
399399
explain_lint_level_source(lint, level, src, &mut *err);
400400
err.emit()
401401
}
402-
struct_lint_level_impl(sess, lint, level, src, span, msg, Box::new(decorate))
402+
lint_level_impl(sess, lint, level, src, span, msg, Box::new(decorate))
403403
}
404404

405405
/// Returns whether `span` originates in a foreign crate's external macro.

compiler/rustc_middle/src/ty/context.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub mod tls;
77
use crate::arena::Arena;
88
use crate::dep_graph::{DepGraph, DepKindStruct};
99
use crate::infer::canonical::{CanonicalParamEnvCache, CanonicalVarInfo, CanonicalVarInfos};
10-
use crate::lint::struct_lint_level;
10+
use crate::lint::lint_level;
1111
use crate::metadata::ModChild;
1212
use crate::middle::codegen_fn_attrs::CodegenFnAttrs;
1313
use crate::middle::resolve_bound_vars;
@@ -2086,14 +2086,14 @@ impl<'tcx> TyCtxt<'tcx> {
20862086
) {
20872087
let msg = decorator.msg();
20882088
let (level, src) = self.lint_level_at_node(lint, hir_id);
2089-
struct_lint_level(self.sess, lint, level, src, Some(span.into()), msg, |diag| {
2089+
lint_level(self.sess, lint, level, src, Some(span.into()), msg, |diag| {
20902090
decorator.decorate_lint(diag);
20912091
})
20922092
}
20932093

20942094
/// Emit a lint at the appropriate level for a hir node, with an associated span.
20952095
///
2096-
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
2096+
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
20972097
#[rustc_lint_diagnostics]
20982098
#[track_caller]
20992099
pub fn node_span_lint(
@@ -2105,7 +2105,7 @@ impl<'tcx> TyCtxt<'tcx> {
21052105
decorate: impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>),
21062106
) {
21072107
let (level, src) = self.lint_level_at_node(lint, hir_id);
2108-
struct_lint_level(self.sess, lint, level, src, Some(span.into()), msg, decorate);
2108+
lint_level(self.sess, lint, level, src, Some(span.into()), msg, decorate);
21092109
}
21102110

21112111
/// Emit a lint from a lint struct (some type that implements `DecorateLint`, typically
@@ -2124,7 +2124,7 @@ impl<'tcx> TyCtxt<'tcx> {
21242124

21252125
/// Emit a lint at the appropriate level for a hir node.
21262126
///
2127-
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
2127+
/// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
21282128
#[rustc_lint_diagnostics]
21292129
#[track_caller]
21302130
pub fn node_lint(
@@ -2135,7 +2135,7 @@ impl<'tcx> TyCtxt<'tcx> {
21352135
decorate: impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>),
21362136
) {
21372137
let (level, src) = self.lint_level_at_node(lint, id);
2138-
struct_lint_level(self.sess, lint, level, src, None, msg, decorate);
2138+
lint_level(self.sess, lint, level, src, None, msg, decorate);
21392139
}
21402140

21412141
pub fn in_scope_traits(self, id: HirId) -> Option<&'tcx [TraitCandidate]> {

compiler/rustc_session/src/parse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn feature_warn_issue(
144144
let mut err = sess.parse_sess.dcx.struct_span_warn(span, explain);
145145
add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false);
146146

147-
// Decorate this as a future-incompatibility lint as in rustc_middle::lint::struct_lint_level
147+
// Decorate this as a future-incompatibility lint as in rustc_middle::lint::lint_level
148148
let lint = UNSTABLE_SYNTAX_PRE_EXPANSION;
149149
let future_incompatible = lint.future_incompatible.as_ref().unwrap();
150150
err.is_lint(lint.name_lower(), /* has_future_breakage */ false);

0 commit comments

Comments
 (0)