Skip to content

Commit d363f05

Browse files
committed
Rename TyCtxt::emit_spanned_lint as TyCtxt::emit_node_span_lint.
1 parent 5222975 commit d363f05

File tree

33 files changed

+131
-143
lines changed

33 files changed

+131
-143
lines changed

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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/lint.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,24 +228,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
228228
diag.stash(self_ty.span, StashKey::TraitMissingMethod);
229229
} else {
230230
let msg = "trait objects without an explicit `dyn` are deprecated";
231-
tcx.node_span_lint(
232-
BARE_TRAIT_OBJECTS,
233-
self_ty.hir_id,
234-
self_ty.span,
235-
msg,
236-
|lint| {
237-
if self_ty.span.can_be_used_for_suggestions()
238-
&& !self.maybe_lint_impl_trait(self_ty, lint)
239-
{
240-
lint.multipart_suggestion_verbose(
241-
"use `dyn`",
242-
sugg,
243-
Applicability::MachineApplicable,
244-
);
245-
}
246-
self.maybe_lint_blanket_trait_impl(self_ty, lint);
247-
},
248-
);
231+
tcx.node_span_lint(BARE_TRAIT_OBJECTS, self_ty.hir_id, self_ty.span, msg, |lint| {
232+
if self_ty.span.can_be_used_for_suggestions()
233+
&& !self.maybe_lint_impl_trait(self_ty, lint)
234+
{
235+
lint.multipart_suggestion_verbose(
236+
"use `dyn`",
237+
sugg,
238+
Applicability::MachineApplicable,
239+
);
240+
}
241+
self.maybe_lint_blanket_trait_impl(self_ty, lint);
242+
});
249243
}
250244
}
251245
}

compiler/rustc_hir_analysis/src/astconv/object_safety.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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_analysis/src/check_unused.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) {
4040
} else {
4141
"unused import".to_owned()
4242
};
43-
tcx.node_span_lint(
44-
lint::builtin::UNUSED_IMPORTS,
45-
item.hir_id(),
46-
path.span,
47-
msg,
48-
|_| {},
49-
);
43+
tcx.node_span_lint(lint::builtin::UNUSED_IMPORTS, item.hir_id(), path.span, msg, |_| {});
5044
}
5145
}

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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,

0 commit comments

Comments
 (0)