Skip to content

Commit cfdea76

Browse files
committed
Rename TyCtxt::struct_span_lint_hir as TyCtxt::node_span_lint.
1 parent 681b9aa commit cfdea76

File tree

34 files changed

+56
-68
lines changed

34 files changed

+56
-68
lines changed

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
563563
if codegen_fn_attrs.inline == InlineAttr::Always {
564564
if let (Some(no_sanitize_span), Some(inline_span)) = (no_sanitize_span, inline_span) {
565565
let hir_id = tcx.local_def_id_to_hir_id(did);
566-
tcx.struct_span_lint_hir(
566+
tcx.node_span_lint(
567567
lint::builtin::INLINE_NO_SANITIZE,
568568
hir_id,
569569
no_sanitize_span,

compiler/rustc_hir_analysis/src/astconv/generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ pub(crate) fn prohibit_explicit_late_bound_lifetimes(
656656
} else {
657657
let mut multispan = MultiSpan::from_span(span);
658658
multispan.push_span_label(span_late, note);
659-
tcx.struct_span_lint_hir(
659+
tcx.node_span_lint(
660660
LATE_BOUND_LIFETIME_ARGUMENTS,
661661
args.args[0].hir_id(),
662662
multispan,

compiler/rustc_hir_analysis/src/astconv/lint.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -240,24 +240,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
240240
diag.stash(self_ty.span, StashKey::TraitMissingMethod);
241241
} else {
242242
let msg = "trait objects without an explicit `dyn` are deprecated";
243-
tcx.struct_span_lint_hir(
244-
BARE_TRAIT_OBJECTS,
245-
self_ty.hir_id,
246-
self_ty.span,
247-
msg,
248-
|lint| {
249-
if self_ty.span.can_be_used_for_suggestions()
250-
&& !self.maybe_lint_impl_trait(self_ty, lint)
251-
{
252-
lint.multipart_suggestion_verbose(
253-
"use `dyn`",
254-
sugg,
255-
Applicability::MachineApplicable,
256-
);
257-
}
258-
self.maybe_lint_blanket_trait_impl(self_ty, lint);
259-
},
260-
);
243+
tcx.node_span_lint(BARE_TRAIT_OBJECTS, self_ty.hir_id, self_ty.span, msg, |lint| {
244+
if self_ty.span.can_be_used_for_suggestions()
245+
&& !self.maybe_lint_impl_trait(self_ty, lint)
246+
{
247+
lint.multipart_suggestion_verbose(
248+
"use `dyn`",
249+
sugg,
250+
Applicability::MachineApplicable,
251+
);
252+
}
253+
self.maybe_lint_blanket_trait_impl(self_ty, lint);
254+
});
261255
}
262256
}
263257
}

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
13941394
let ty = self.projected_ty_from_poly_trait_ref(span, assoc_ty_did, assoc_segment, bound);
13951395

13961396
if let Some(variant_def_id) = variant_resolution {
1397-
tcx.struct_span_lint_hir(
1397+
tcx.node_span_lint(
13981398
AMBIGUOUS_ASSOCIATED_ITEMS,
13991399
hir_ref_id,
14001400
span,

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Abi) {
4646
.emit();
4747
}
4848
None => {
49-
tcx.struct_span_lint_hir(
49+
tcx.node_span_lint(
5050
UNSUPPORTED_CALLING_CONVENTIONS,
5151
hir_id,
5252
span,
@@ -183,7 +183,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
183183
}
184184
};
185185
if layout.abi.is_uninhabited() {
186-
tcx.struct_span_lint_hir(
186+
tcx.node_span_lint(
187187
UNINHABITED_STATIC,
188188
tcx.local_def_id_to_hir_id(def_id),
189189
span,
@@ -1079,7 +1079,7 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
10791079
// If there are any non-trivial fields, then there can be no non-exhaustive 1-zsts.
10801080
// Otherwise, it's only an issue if there's >1 non-exhaustive 1-zst.
10811081
if non_trivial_count > 0 || prev_non_exhaustive_1zst {
1082-
tcx.struct_span_lint_hir(
1082+
tcx.node_span_lint(
10831083
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS,
10841084
tcx.local_def_id_to_hir_id(adt.did().expect_local()),
10851085
span,

compiler/rustc_hir_analysis/src/check/intrinsicck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
270270
if !spans.is_empty() {
271271
let (default_modifier, default_result) =
272272
reg_class.default_modifier(asm_arch).unwrap();
273-
self.tcx.struct_span_lint_hir(
273+
self.tcx.node_span_lint(
274274
lint::builtin::ASM_SUB_REGISTER,
275275
expr.hir_id,
276276
spans,

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.struct_span_lint_hir(
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_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ fn lint_auto_trait_impl<'tcx>(
495495
return;
496496
}
497497

498-
tcx.struct_span_lint_hir(
498+
tcx.node_span_lint(
499499
lint::builtin::SUSPICIOUS_AUTO_TRAIT_IMPLS,
500500
tcx.local_def_id_to_hir_id(impl_def_id),
501501
tcx.def_span(impl_def_id),

compiler/rustc_hir_analysis/src/collect/generics_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
274274
Defaults::FutureCompatDisallowed
275275
if tcx.features().default_type_parameter_fallback => {}
276276
Defaults::FutureCompatDisallowed => {
277-
tcx.struct_span_lint_hir(
277+
tcx.node_span_lint(
278278
lint::builtin::INVALID_TYPE_PARAM_DEFAULT,
279279
param.hir_id,
280280
param.span,

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
912912
continue;
913913
}
914914
self.insert_lifetime(lt, ResolvedArg::StaticLifetime);
915-
self.tcx.struct_span_lint_hir(
915+
self.tcx.node_span_lint(
916916
lint::builtin::UNUSED_LIFETIMES,
917917
lifetime.hir_id,
918918
lifetime.ident.span,

0 commit comments

Comments
 (0)