about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-01-16 16:14:33 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-01-23 08:09:01 +1100
commitcfdea760f5ca36fdd04c8f18f3dac0bef66055cc (patch)
tree4daba05dce1c25b379bec55475f47998984e910e /compiler/rustc_hir_analysis
parent681b9aa363d350a4b8ecb9eedc025baa6e0bf9ca (diff)
downloadrust-cfdea760f5ca36fdd04c8f18f3dac0bef66055cc.tar.gz
rust-cfdea760f5ca36fdd04c8f18f3dac0bef66055cc.zip
Rename `TyCtxt::struct_span_lint_hir` as `TyCtxt::node_span_lint`.
Diffstat (limited to 'compiler/rustc_hir_analysis')
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/generics.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/lint.rs30
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/mod.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs6
-rw-r--r--compiler/rustc_hir_analysis/src/check/intrinsicck.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/check_unused.rs8
-rw-r--r--compiler/rustc_hir_analysis/src/coherence/orphan.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/collect/generics_of.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs2
9 files changed, 22 insertions, 34 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/generics.rs b/compiler/rustc_hir_analysis/src/astconv/generics.rs
index f9628d1d6f3..4284758b117 100644
--- a/compiler/rustc_hir_analysis/src/astconv/generics.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/generics.rs
@@ -656,7 +656,7 @@ pub(crate) fn prohibit_explicit_late_bound_lifetimes(
         } else {
             let mut multispan = MultiSpan::from_span(span);
             multispan.push_span_label(span_late, note);
-            tcx.struct_span_lint_hir(
+            tcx.node_span_lint(
                 LATE_BOUND_LIFETIME_ARGUMENTS,
                 args.args[0].hir_id(),
                 multispan,
diff --git a/compiler/rustc_hir_analysis/src/astconv/lint.rs b/compiler/rustc_hir_analysis/src/astconv/lint.rs
index 27dc088d5dd..33e782abc68 100644
--- a/compiler/rustc_hir_analysis/src/astconv/lint.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/lint.rs
@@ -240,24 +240,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                 diag.stash(self_ty.span, StashKey::TraitMissingMethod);
             } else {
                 let msg = "trait objects without an explicit `dyn` are deprecated";
-                tcx.struct_span_lint_hir(
-                    BARE_TRAIT_OBJECTS,
-                    self_ty.hir_id,
-                    self_ty.span,
-                    msg,
-                    |lint| {
-                        if self_ty.span.can_be_used_for_suggestions()
-                            && !self.maybe_lint_impl_trait(self_ty, lint)
-                        {
-                            lint.multipart_suggestion_verbose(
-                                "use `dyn`",
-                                sugg,
-                                Applicability::MachineApplicable,
-                            );
-                        }
-                        self.maybe_lint_blanket_trait_impl(self_ty, lint);
-                    },
-                );
+                tcx.node_span_lint(BARE_TRAIT_OBJECTS, self_ty.hir_id, self_ty.span, msg, |lint| {
+                    if self_ty.span.can_be_used_for_suggestions()
+                        && !self.maybe_lint_impl_trait(self_ty, lint)
+                    {
+                        lint.multipart_suggestion_verbose(
+                            "use `dyn`",
+                            sugg,
+                            Applicability::MachineApplicable,
+                        );
+                    }
+                    self.maybe_lint_blanket_trait_impl(self_ty, lint);
+                });
             }
         }
     }
diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs
index 00f0d6e7c22..7c97c2a1a6f 100644
--- a/compiler/rustc_hir_analysis/src/astconv/mod.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs
@@ -1394,7 +1394,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
         let ty = self.projected_ty_from_poly_trait_ref(span, assoc_ty_did, assoc_segment, bound);
 
         if let Some(variant_def_id) = variant_resolution {
-            tcx.struct_span_lint_hir(
+            tcx.node_span_lint(
                 AMBIGUOUS_ASSOCIATED_ITEMS,
                 hir_ref_id,
                 span,
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index 03e2b0e0022..c63bafcdcd4 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -46,7 +46,7 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Abi) {
             .emit();
         }
         None => {
-            tcx.struct_span_lint_hir(
+            tcx.node_span_lint(
                 UNSUPPORTED_CALLING_CONVENTIONS,
                 hir_id,
                 span,
@@ -183,7 +183,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
         }
     };
     if layout.abi.is_uninhabited() {
-        tcx.struct_span_lint_hir(
+        tcx.node_span_lint(
             UNINHABITED_STATIC,
             tcx.local_def_id_to_hir_id(def_id),
             span,
@@ -1079,7 +1079,7 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
             // If there are any non-trivial fields, then there can be no non-exhaustive 1-zsts.
             // Otherwise, it's only an issue if there's >1 non-exhaustive 1-zst.
             if non_trivial_count > 0 || prev_non_exhaustive_1zst {
-                tcx.struct_span_lint_hir(
+                tcx.node_span_lint(
                     REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS,
                     tcx.local_def_id_to_hir_id(adt.did().expect_local()),
                     span,
diff --git a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
index db619d5169e..d03b02f028d 100644
--- a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
+++ b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
@@ -270,7 +270,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
             if !spans.is_empty() {
                 let (default_modifier, default_result) =
                     reg_class.default_modifier(asm_arch).unwrap();
-                self.tcx.struct_span_lint_hir(
+                self.tcx.node_span_lint(
                     lint::builtin::ASM_SUB_REGISTER,
                     expr.hir_id,
                     spans,
diff --git a/compiler/rustc_hir_analysis/src/check_unused.rs b/compiler/rustc_hir_analysis/src/check_unused.rs
index 36cb8f7a202..aa5db4f6aa7 100644
--- a/compiler/rustc_hir_analysis/src/check_unused.rs
+++ b/compiler/rustc_hir_analysis/src/check_unused.rs
@@ -40,12 +40,6 @@ fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) {
         } else {
             "unused import".to_owned()
         };
-        tcx.struct_span_lint_hir(
-            lint::builtin::UNUSED_IMPORTS,
-            item.hir_id(),
-            path.span,
-            msg,
-            |_| {},
-        );
+        tcx.node_span_lint(lint::builtin::UNUSED_IMPORTS, item.hir_id(), path.span, msg, |_| {});
     }
 }
diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs
index c1d0e0444b6..1736de760d5 100644
--- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs
+++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs
@@ -495,7 +495,7 @@ fn lint_auto_trait_impl<'tcx>(
         return;
     }
 
-    tcx.struct_span_lint_hir(
+    tcx.node_span_lint(
         lint::builtin::SUSPICIOUS_AUTO_TRAIT_IMPLS,
         tcx.local_def_id_to_hir_id(impl_def_id),
         tcx.def_span(impl_def_id),
diff --git a/compiler/rustc_hir_analysis/src/collect/generics_of.rs b/compiler/rustc_hir_analysis/src/collect/generics_of.rs
index b44b2eefabb..c29d4131843 100644
--- a/compiler/rustc_hir_analysis/src/collect/generics_of.rs
+++ b/compiler/rustc_hir_analysis/src/collect/generics_of.rs
@@ -274,7 +274,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
                     Defaults::FutureCompatDisallowed
                         if tcx.features().default_type_parameter_fallback => {}
                     Defaults::FutureCompatDisallowed => {
-                        tcx.struct_span_lint_hir(
+                        tcx.node_span_lint(
                             lint::builtin::INVALID_TYPE_PARAM_DEFAULT,
                             param.hir_id,
                             param.span,
diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
index 4f049f699e6..a857e01f4fa 100644
--- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
+++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
@@ -912,7 +912,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
                             continue;
                         }
                         self.insert_lifetime(lt, ResolvedArg::StaticLifetime);
-                        self.tcx.struct_span_lint_hir(
+                        self.tcx.node_span_lint(
                             lint::builtin::UNUSED_LIFETIMES,
                             lifetime.hir_id,
                             lifetime.ident.span,