Skip to content

Commit e164cf3

Browse files
committed
Rename TyCtxt::emit_spanned_lint as TyCtxt::emit_node_span_lint.
1 parent 82ca070 commit e164cf3

File tree

32 files changed

+118
-118
lines changed

32 files changed

+118
-118
lines changed

compiler/rustc_borrowck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ fn do_mir_borrowck<'tcx>(
415415

416416
let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
417417

418-
tcx.emit_spanned_lint(UNUSED_MUT, lint_root, span, VarNeedNotMut { span: mut_span })
418+
tcx.emit_node_span_lint(UNUSED_MUT, lint_root, span, VarNeedNotMut { span: mut_span })
419419
}
420420

421421
let tainted_by_errors = mbcx.emit_errors();

compiler/rustc_const_eval/src/const_eval/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ pub(super) fn lint<'tcx, 'mir, L>(
175175
{
176176
let (span, frames) = get_span_and_frames(tcx, machine);
177177

178-
tcx.emit_spanned_lint(
178+
tcx.emit_node_span_lint(
179179
lint,
180180
// We use the root frame for this so the crate that defines the const defines whether the
181181
// lint is emitted.

compiler/rustc_const_eval/src/const_eval/machine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
611611
.0
612612
.is_error();
613613
let span = ecx.cur_span();
614-
ecx.tcx.emit_spanned_lint(
614+
ecx.tcx.emit_node_span_lint(
615615
rustc_session::lint::builtin::LONG_RUNNING_CONST_EVAL,
616616
hir_id,
617617
span,

compiler/rustc_hir_analysis/src/astconv/object_safety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
220220
let def_id = projection_bound.projection_def_id();
221221
def_ids.remove(&def_id);
222222
if tcx.generics_require_sized_self(def_id) {
223-
tcx.emit_spanned_lint(
223+
tcx.emit_node_span_lint(
224224
UNUSED_ASSOCIATED_TYPE_BOUNDS,
225225
hir_id,
226226
*span,

compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ fn report_mismatched_rpitit_signature<'tcx>(
283283
});
284284

285285
let span = unmatched_bound.unwrap_or(span);
286-
tcx.emit_spanned_lint(
286+
tcx.emit_node_span_lint(
287287
REFINING_IMPL_TRAIT,
288288
tcx.local_def_id_to_hir_id(impl_m_def_id.expect_local()),
289289
span,

compiler/rustc_hir_analysis/src/check/errs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn handle_static_mut_ref(
8888
"shared ",
8989
)
9090
};
91-
tcx.emit_spanned_lint(
91+
tcx.emit_node_span_lint(
9292
STATIC_MUT_REF,
9393
hir_id,
9494
span,

compiler/rustc_hir_typeck/src/cast.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
587587
};
588588
let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
589589
let cast_ty = fcx.resolve_vars_if_possible(self.cast_ty);
590-
fcx.tcx.emit_spanned_lint(
590+
fcx.tcx.emit_node_span_lint(
591591
lint,
592592
self.expr.hir_id,
593593
self.span,
@@ -900,7 +900,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
900900
let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
901901
let cast_ty = fcx.resolve_vars_if_possible(self.cast_ty);
902902

903-
fcx.tcx.emit_spanned_lint(
903+
fcx.tcx.emit_node_span_lint(
904904
lint::builtin::CENUM_IMPL_DROP_CAST,
905905
self.expr.hir_id,
906906
self.span,
@@ -934,7 +934,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
934934
};
935935

936936
let lint = errors::LossyProvenancePtr2Int { expr_ty, cast_ty, sugg };
937-
fcx.tcx.emit_spanned_lint(
937+
fcx.tcx.emit_node_span_lint(
938938
lint::builtin::LOSSY_PROVENANCE_CASTS,
939939
self.expr.hir_id,
940940
self.span,
@@ -950,7 +950,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
950950
let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
951951
let cast_ty = fcx.resolve_vars_if_possible(self.cast_ty);
952952
let lint = errors::LossyProvenanceInt2Ptr { expr_ty, cast_ty, sugg };
953-
fcx.tcx.emit_spanned_lint(
953+
fcx.tcx.emit_node_span_lint(
954954
lint::builtin::FUZZY_PROVENANCE_CASTS,
955955
self.expr.hir_id,
956956
self.span,

compiler/rustc_lint/src/async_fn_in_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'tcx> LateLintPass<'tcx> for AsyncFnInTrait {
116116
def.owner_id.def_id,
117117
" + Send",
118118
);
119-
cx.tcx.emit_spanned_lint(
119+
cx.tcx.emit_node_span_lint(
120120
ASYNC_FN_IN_TRAIT,
121121
item.hir_id(),
122122
async_span,

compiler/rustc_lint/src/expect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
2929
{
3030
let rationale = expectation.reason.map(|rationale| ExpectationNote { rationale });
3131
let note = expectation.is_unfulfilled_lint_expectations.then_some(());
32-
tcx.emit_spanned_lint(
32+
tcx.emit_node_span_lint(
3333
UNFULFILLED_LINT_EXPECTATIONS,
3434
*hir_id,
3535
expectation.emission_span,

compiler/rustc_lint/src/foreign_modules.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl ClashingExternDeclarations {
161161
sub,
162162
}
163163
};
164-
tcx.emit_spanned_lint(
164+
tcx.emit_node_span_lint(
165165
CLASHING_EXTERN_DECLARATIONS,
166166
this_fi.hir_id(),
167167
mismatch_label,

compiler/rustc_middle/src/lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub fn explain_lint_level_source(
247247
///
248248
/// If you are looking to implement a lint, look for higher level functions,
249249
/// for example:
250-
/// - [`TyCtxt::emit_spanned_lint`]
250+
/// - [`TyCtxt::emit_node_span_lint`]
251251
/// - [`TyCtxt::node_span_lint`]
252252
/// - [`TyCtxt::emit_node_lint`]
253253
/// - [`TyCtxt::node_lint`]

compiler/rustc_middle/src/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2077,7 +2077,7 @@ impl<'tcx> TyCtxt<'tcx> {
20772077
/// Emit a lint at `span` from a lint struct (some type that implements `DecorateLint`,
20782078
/// typically generated by `#[derive(LintDiagnostic)]`).
20792079
#[track_caller]
2080-
pub fn emit_spanned_lint(
2080+
pub fn emit_node_span_lint(
20812081
self,
20822082
lint: &'static Lint,
20832083
hir_id: HirId,

compiler/rustc_mir_build/src/check_unsafety.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ impl UnsafeOpKind {
599599
// FIXME: ideally we would want to trim the def paths, but this is not
600600
// feasible with the current lint emission API (see issue #106126).
601601
match self {
602-
CallToUnsafeFunction(Some(did)) => tcx.emit_spanned_lint(
602+
CallToUnsafeFunction(Some(did)) => tcx.emit_node_span_lint(
603603
UNSAFE_OP_IN_UNSAFE_FN,
604604
hir_id,
605605
span,
@@ -609,7 +609,7 @@ impl UnsafeOpKind {
609609
unsafe_not_inherited_note,
610610
},
611611
),
612-
CallToUnsafeFunction(None) => tcx.emit_spanned_lint(
612+
CallToUnsafeFunction(None) => tcx.emit_node_span_lint(
613613
UNSAFE_OP_IN_UNSAFE_FN,
614614
hir_id,
615615
span,
@@ -618,7 +618,7 @@ impl UnsafeOpKind {
618618
unsafe_not_inherited_note,
619619
},
620620
),
621-
UseOfInlineAssembly => tcx.emit_spanned_lint(
621+
UseOfInlineAssembly => tcx.emit_node_span_lint(
622622
UNSAFE_OP_IN_UNSAFE_FN,
623623
hir_id,
624624
span,
@@ -627,7 +627,7 @@ impl UnsafeOpKind {
627627
unsafe_not_inherited_note,
628628
},
629629
),
630-
InitializingTypeWith => tcx.emit_spanned_lint(
630+
InitializingTypeWith => tcx.emit_node_span_lint(
631631
UNSAFE_OP_IN_UNSAFE_FN,
632632
hir_id,
633633
span,
@@ -636,7 +636,7 @@ impl UnsafeOpKind {
636636
unsafe_not_inherited_note,
637637
},
638638
),
639-
UseOfMutableStatic => tcx.emit_spanned_lint(
639+
UseOfMutableStatic => tcx.emit_node_span_lint(
640640
UNSAFE_OP_IN_UNSAFE_FN,
641641
hir_id,
642642
span,
@@ -645,7 +645,7 @@ impl UnsafeOpKind {
645645
unsafe_not_inherited_note,
646646
},
647647
),
648-
UseOfExternStatic => tcx.emit_spanned_lint(
648+
UseOfExternStatic => tcx.emit_node_span_lint(
649649
UNSAFE_OP_IN_UNSAFE_FN,
650650
hir_id,
651651
span,
@@ -654,7 +654,7 @@ impl UnsafeOpKind {
654654
unsafe_not_inherited_note,
655655
},
656656
),
657-
DerefOfRawPointer => tcx.emit_spanned_lint(
657+
DerefOfRawPointer => tcx.emit_node_span_lint(
658658
UNSAFE_OP_IN_UNSAFE_FN,
659659
hir_id,
660660
span,
@@ -663,7 +663,7 @@ impl UnsafeOpKind {
663663
unsafe_not_inherited_note,
664664
},
665665
),
666-
AccessToUnionField => tcx.emit_spanned_lint(
666+
AccessToUnionField => tcx.emit_node_span_lint(
667667
UNSAFE_OP_IN_UNSAFE_FN,
668668
hir_id,
669669
span,
@@ -672,7 +672,7 @@ impl UnsafeOpKind {
672672
unsafe_not_inherited_note,
673673
},
674674
),
675-
MutationOfLayoutConstrainedField => tcx.emit_spanned_lint(
675+
MutationOfLayoutConstrainedField => tcx.emit_node_span_lint(
676676
UNSAFE_OP_IN_UNSAFE_FN,
677677
hir_id,
678678
span,
@@ -681,7 +681,7 @@ impl UnsafeOpKind {
681681
unsafe_not_inherited_note,
682682
},
683683
),
684-
BorrowOfLayoutConstrainedField => tcx.emit_spanned_lint(
684+
BorrowOfLayoutConstrainedField => tcx.emit_node_span_lint(
685685
UNSAFE_OP_IN_UNSAFE_FN,
686686
hir_id,
687687
span,
@@ -690,7 +690,7 @@ impl UnsafeOpKind {
690690
unsafe_not_inherited_note,
691691
},
692692
),
693-
CallToFunctionWith { function, missing, build_enabled } => tcx.emit_spanned_lint(
693+
CallToFunctionWith { function, missing, build_enabled } => tcx.emit_node_span_lint(
694694
UNSAFE_OP_IN_UNSAFE_FN,
695695
hir_id,
696696
span,
@@ -941,7 +941,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
941941
warnings.sort_by_key(|w| w.block_span);
942942
for UnusedUnsafeWarning { hir_id, block_span, enclosing_unsafe } in warnings {
943943
let block_span = tcx.sess.source_map().guess_head_span(block_span);
944-
tcx.emit_spanned_lint(
944+
tcx.emit_node_span_lint(
945945
UNUSED_UNSAFE,
946946
hir_id,
947947
block_span,

compiler/rustc_mir_build/src/lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn check_recursion<'tcx>(
5353

5454
let sp = tcx.def_span(def_id);
5555
let hir_id = tcx.local_def_id_to_hir_id(def_id);
56-
tcx.emit_spanned_lint(
56+
tcx.emit_node_span_lint(
5757
UNCONDITIONAL_RECURSION,
5858
hir_id,
5959
sp,

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
539539
let span_end = prefix.last().unwrap().unwrap().0;
540540
let span = span_start.to(span_end);
541541
let count = prefix.len();
542-
self.tcx.emit_spanned_lint(
542+
self.tcx.emit_node_span_lint(
543543
IRREFUTABLE_LET_PATTERNS,
544544
self.lint_level,
545545
span,
@@ -558,7 +558,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
558558
let span_end = suffix.last().unwrap().unwrap().0;
559559
let span = span_start.to(span_end);
560560
let count = suffix.len();
561-
self.tcx.emit_spanned_lint(
561+
self.tcx.emit_node_span_lint(
562562
IRREFUTABLE_LET_PATTERNS,
563563
self.lint_level,
564564
span,
@@ -814,7 +814,7 @@ fn check_for_bindings_named_same_as_variants(
814814
{
815815
let variant_count = edef.variants().len();
816816
let ty_path = with_no_trimmed_paths!(cx.tcx.def_path_str(edef.did()));
817-
cx.tcx.emit_spanned_lint(
817+
cx.tcx.emit_node_span_lint(
818818
BINDINGS_WITH_VARIANT_NAME,
819819
cx.lint_level,
820820
pat.span,
@@ -856,7 +856,7 @@ fn report_irrefutable_let_patterns(
856856
) {
857857
macro_rules! emit_diag {
858858
($lint:tt) => {{
859-
tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, id, span, $lint { count });
859+
tcx.emit_node_span_lint(IRREFUTABLE_LET_PATTERNS, id, span, $lint { count });
860860
}};
861861
}
862862

@@ -876,7 +876,7 @@ fn report_unreachable_pattern<'p, 'tcx>(
876876
span: Span,
877877
catchall: Option<Span>,
878878
) {
879-
cx.tcx.emit_spanned_lint(
879+
cx.tcx.emit_node_span_lint(
880880
UNREACHABLE_PATTERNS,
881881
hir_id,
882882
span,

compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'tcx> ConstToPat<'tcx> {
214214
if let Some(mir_structural_match_violation) = mir_structural_match_violation {
215215
match non_sm_ty.kind() {
216216
ty::Adt(..) if mir_structural_match_violation => {
217-
self.tcx().emit_spanned_lint(
217+
self.tcx().emit_node_span_lint(
218218
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
219219
self.id,
220220
self.span,
@@ -233,7 +233,7 @@ impl<'tcx> ConstToPat<'tcx> {
233233
} else if !have_valtree && !self.saw_const_match_lint.get() {
234234
// The only way valtree construction can fail without the structural match
235235
// checker finding a violation is if there is a pointer somewhere.
236-
self.tcx().emit_spanned_lint(
236+
self.tcx().emit_node_span_lint(
237237
lint::builtin::POINTER_STRUCTURAL_MATCH,
238238
self.id,
239239
self.span,
@@ -244,7 +244,7 @@ impl<'tcx> ConstToPat<'tcx> {
244244
// Always check for `PartialEq`, even if we emitted other lints. (But not if there were
245245
// any errors.) This ensures it shows up in cargo's future-compat reports as well.
246246
if !self.type_has_partial_eq_impl(cv.ty()) {
247-
self.tcx().emit_spanned_lint(
247+
self.tcx().emit_node_span_lint(
248248
lint::builtin::CONST_PATTERNS_WITHOUT_PARTIAL_EQ,
249249
self.id,
250250
self.span,
@@ -319,7 +319,7 @@ impl<'tcx> ConstToPat<'tcx> {
319319
let kind = match ty.kind() {
320320
ty::Float(_) => {
321321
self.saw_const_match_lint.set(true);
322-
tcx.emit_spanned_lint(
322+
tcx.emit_node_span_lint(
323323
lint::builtin::ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
324324
id,
325325
span,
@@ -339,7 +339,7 @@ impl<'tcx> ConstToPat<'tcx> {
339339
ty::Adt(..) if !self.type_marked_structural(ty) && self.behind_reference.get() => {
340340
if self.saw_const_match_error.get().is_none() && !self.saw_const_match_lint.get() {
341341
self.saw_const_match_lint.set(true);
342-
tcx.emit_spanned_lint(
342+
tcx.emit_node_span_lint(
343343
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
344344
id,
345345
span,
@@ -435,7 +435,7 @@ impl<'tcx> ConstToPat<'tcx> {
435435
&& !self.saw_const_match_lint.get()
436436
{
437437
self.saw_const_match_lint.set(true);
438-
tcx.emit_spanned_lint(
438+
tcx.emit_node_span_lint(
439439
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
440440
self.id,
441441
span,
@@ -516,7 +516,7 @@ impl<'tcx> ConstToPat<'tcx> {
516516
&& let Some(non_sm_ty) = traits::search_for_structural_match_violation(span, tcx, ty)
517517
{
518518
self.saw_const_match_lint.set(true);
519-
tcx.emit_spanned_lint(
519+
tcx.emit_node_span_lint(
520520
lint::builtin::NONTRIVIAL_STRUCTURAL_MATCH,
521521
id,
522522
span,

compiler/rustc_mir_transform/src/check_const_item_mutation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> {
100100
&& let Some((lint_root, span, item)) =
101101
self.should_lint_const_item_usage(lhs, def_id, loc)
102102
{
103-
self.tcx.emit_spanned_lint(
103+
self.tcx.emit_node_span_lint(
104104
CONST_ITEM_MUTATION,
105105
lint_root,
106106
span,
@@ -145,7 +145,7 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> {
145145
if let Some((lint_root, span, item)) =
146146
self.should_lint_const_item_usage(place, def_id, lint_loc)
147147
{
148-
self.tcx.emit_spanned_lint(
148+
self.tcx.emit_node_span_lint(
149149
CONST_ITEM_MUTATION,
150150
lint_root,
151151
span,

compiler/rustc_mir_transform/src/check_unsafety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ fn report_unused_unsafe(tcx: TyCtxt<'_>, kind: UnusedUnsafe, id: HirId) {
527527
} else {
528528
None
529529
};
530-
tcx.emit_spanned_lint(UNUSED_UNSAFE, id, span, errors::UnusedUnsafe { span, nested_parent });
530+
tcx.emit_node_span_lint(UNUSED_UNSAFE, id, span, errors::UnusedUnsafe { span, nested_parent });
531531
}
532532

533533
pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
@@ -577,7 +577,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
577577
});
578578
}
579579
UnsafetyViolationKind::UnsafeFn => {
580-
tcx.emit_spanned_lint(
580+
tcx.emit_node_span_lint(
581581
UNSAFE_OP_IN_UNSAFE_FN,
582582
lint_root,
583583
source_info.span,

0 commit comments

Comments
 (0)