1
Fork 0

Rename TyCtxt::emit_spanned_lint as TyCtxt::emit_node_span_lint.

This commit is contained in:
Nicholas Nethercote 2024-01-16 16:27:02 +11:00
parent 82ca070c16
commit e164cf30f8
32 changed files with 118 additions and 118 deletions

View file

@ -599,7 +599,7 @@ impl UnsafeOpKind {
// FIXME: ideally we would want to trim the def paths, but this is not
// feasible with the current lint emission API (see issue #106126).
match self {
CallToUnsafeFunction(Some(did)) => tcx.emit_spanned_lint(
CallToUnsafeFunction(Some(did)) => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -609,7 +609,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
CallToUnsafeFunction(None) => tcx.emit_spanned_lint(
CallToUnsafeFunction(None) => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -618,7 +618,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
UseOfInlineAssembly => tcx.emit_spanned_lint(
UseOfInlineAssembly => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -627,7 +627,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
InitializingTypeWith => tcx.emit_spanned_lint(
InitializingTypeWith => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -636,7 +636,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
UseOfMutableStatic => tcx.emit_spanned_lint(
UseOfMutableStatic => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -645,7 +645,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
UseOfExternStatic => tcx.emit_spanned_lint(
UseOfExternStatic => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -654,7 +654,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
DerefOfRawPointer => tcx.emit_spanned_lint(
DerefOfRawPointer => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -663,7 +663,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
AccessToUnionField => tcx.emit_spanned_lint(
AccessToUnionField => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -672,7 +672,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
MutationOfLayoutConstrainedField => tcx.emit_spanned_lint(
MutationOfLayoutConstrainedField => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -681,7 +681,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
BorrowOfLayoutConstrainedField => tcx.emit_spanned_lint(
BorrowOfLayoutConstrainedField => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -690,7 +690,7 @@ impl UnsafeOpKind {
unsafe_not_inherited_note,
},
),
CallToFunctionWith { function, missing, build_enabled } => tcx.emit_spanned_lint(
CallToFunctionWith { function, missing, build_enabled } => tcx.emit_node_span_lint(
UNSAFE_OP_IN_UNSAFE_FN,
hir_id,
span,
@ -941,7 +941,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
warnings.sort_by_key(|w| w.block_span);
for UnusedUnsafeWarning { hir_id, block_span, enclosing_unsafe } in warnings {
let block_span = tcx.sess.source_map().guess_head_span(block_span);
tcx.emit_spanned_lint(
tcx.emit_node_span_lint(
UNUSED_UNSAFE,
hir_id,
block_span,

View file

@ -53,7 +53,7 @@ fn check_recursion<'tcx>(
let sp = tcx.def_span(def_id);
let hir_id = tcx.local_def_id_to_hir_id(def_id);
tcx.emit_spanned_lint(
tcx.emit_node_span_lint(
UNCONDITIONAL_RECURSION,
hir_id,
sp,

View file

@ -539,7 +539,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
let span_end = prefix.last().unwrap().unwrap().0;
let span = span_start.to(span_end);
let count = prefix.len();
self.tcx.emit_spanned_lint(
self.tcx.emit_node_span_lint(
IRREFUTABLE_LET_PATTERNS,
self.lint_level,
span,
@ -558,7 +558,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
let span_end = suffix.last().unwrap().unwrap().0;
let span = span_start.to(span_end);
let count = suffix.len();
self.tcx.emit_spanned_lint(
self.tcx.emit_node_span_lint(
IRREFUTABLE_LET_PATTERNS,
self.lint_level,
span,
@ -814,7 +814,7 @@ fn check_for_bindings_named_same_as_variants(
{
let variant_count = edef.variants().len();
let ty_path = with_no_trimmed_paths!(cx.tcx.def_path_str(edef.did()));
cx.tcx.emit_spanned_lint(
cx.tcx.emit_node_span_lint(
BINDINGS_WITH_VARIANT_NAME,
cx.lint_level,
pat.span,
@ -856,7 +856,7 @@ fn report_irrefutable_let_patterns(
) {
macro_rules! emit_diag {
($lint:tt) => {{
tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, id, span, $lint { count });
tcx.emit_node_span_lint(IRREFUTABLE_LET_PATTERNS, id, span, $lint { count });
}};
}
@ -876,7 +876,7 @@ fn report_unreachable_pattern<'p, 'tcx>(
span: Span,
catchall: Option<Span>,
) {
cx.tcx.emit_spanned_lint(
cx.tcx.emit_node_span_lint(
UNREACHABLE_PATTERNS,
hir_id,
span,

View file

@ -214,7 +214,7 @@ impl<'tcx> ConstToPat<'tcx> {
if let Some(mir_structural_match_violation) = mir_structural_match_violation {
match non_sm_ty.kind() {
ty::Adt(..) if mir_structural_match_violation => {
self.tcx().emit_spanned_lint(
self.tcx().emit_node_span_lint(
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
self.id,
self.span,
@ -233,7 +233,7 @@ impl<'tcx> ConstToPat<'tcx> {
} else if !have_valtree && !self.saw_const_match_lint.get() {
// The only way valtree construction can fail without the structural match
// checker finding a violation is if there is a pointer somewhere.
self.tcx().emit_spanned_lint(
self.tcx().emit_node_span_lint(
lint::builtin::POINTER_STRUCTURAL_MATCH,
self.id,
self.span,
@ -244,7 +244,7 @@ impl<'tcx> ConstToPat<'tcx> {
// Always check for `PartialEq`, even if we emitted other lints. (But not if there were
// any errors.) This ensures it shows up in cargo's future-compat reports as well.
if !self.type_has_partial_eq_impl(cv.ty()) {
self.tcx().emit_spanned_lint(
self.tcx().emit_node_span_lint(
lint::builtin::CONST_PATTERNS_WITHOUT_PARTIAL_EQ,
self.id,
self.span,
@ -319,7 +319,7 @@ impl<'tcx> ConstToPat<'tcx> {
let kind = match ty.kind() {
ty::Float(_) => {
self.saw_const_match_lint.set(true);
tcx.emit_spanned_lint(
tcx.emit_node_span_lint(
lint::builtin::ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
id,
span,
@ -339,7 +339,7 @@ impl<'tcx> ConstToPat<'tcx> {
ty::Adt(..) if !self.type_marked_structural(ty) && self.behind_reference.get() => {
if self.saw_const_match_error.get().is_none() && !self.saw_const_match_lint.get() {
self.saw_const_match_lint.set(true);
tcx.emit_spanned_lint(
tcx.emit_node_span_lint(
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
id,
span,
@ -435,7 +435,7 @@ impl<'tcx> ConstToPat<'tcx> {
&& !self.saw_const_match_lint.get()
{
self.saw_const_match_lint.set(true);
tcx.emit_spanned_lint(
tcx.emit_node_span_lint(
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
self.id,
span,
@ -516,7 +516,7 @@ impl<'tcx> ConstToPat<'tcx> {
&& let Some(non_sm_ty) = traits::search_for_structural_match_violation(span, tcx, ty)
{
self.saw_const_match_lint.set(true);
tcx.emit_spanned_lint(
tcx.emit_node_span_lint(
lint::builtin::NONTRIVIAL_STRUCTURAL_MATCH,
id,
span,