about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-23 00:06:57 +0000
committerbors <bors@rust-lang.org>2024-01-23 00:06:57 +0000
commit0011fac90d2846ea3c04506238ff6e4ed3ce0efe (patch)
tree790800883bc3195caaaa042ec32f3c0d2f6420ef /compiler/rustc_trait_selection/src
parentd6b151fc77e213bf637db0f12c1965ace3ffe255 (diff)
parent15a4c4fc6f1bda15bbc6c40395ff709d1b7fd166 (diff)
downloadrust-0011fac90d2846ea3c04506238ff6e4ed3ce0efe.tar.gz
rust-0011fac90d2846ea3c04506238ff6e4ed3ce0efe.zip
Auto merge of #120017 - nnethercote:lint-api, r=oli-obk
Fix naming in the lint API

Methods for emit lints are named very inconsistently. This PR fixes that up.

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs12
-rw-r--r--compiler/rustc_trait_selection/src/traits/object_safety.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/specialize/mod.rs4
3 files changed, 9 insertions, 9 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs
index 532e2cb36e3..bb1b6ec1390 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs
@@ -359,7 +359,7 @@ impl IgnoredDiagnosticOption {
         option_name: &'static str,
     ) {
         if let (Some(new_item), Some(old_item)) = (new, old) {
-            tcx.emit_spanned_lint(
+            tcx.emit_node_span_lint(
                 UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
                 tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
                 new_item,
@@ -491,7 +491,7 @@ impl<'tcx> OnUnimplementedDirective {
             }
 
             if is_diagnostic_namespace_variant {
-                tcx.emit_spanned_lint(
+                tcx.emit_node_span_lint(
                     UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
                     tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
                     vec![item.span()],
@@ -629,7 +629,7 @@ impl<'tcx> OnUnimplementedDirective {
                     AttrArgs::Eq(span, AttrArgsEq::Hir(expr)) => span.to(expr.span),
                 };
 
-                tcx.emit_spanned_lint(
+                tcx.emit_node_span_lint(
                     UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
                     tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
                     report_span,
@@ -640,14 +640,14 @@ impl<'tcx> OnUnimplementedDirective {
         } else if is_diagnostic_namespace_variant {
             match &attr.kind {
                 AttrKind::Normal(p) if !matches!(p.item.args, AttrArgs::Empty) => {
-                    tcx.emit_spanned_lint(
+                    tcx.emit_node_span_lint(
                         UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
                         tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
                         attr.span,
                         MalformedOnUnimplementedAttrLint::new(attr.span),
                     );
                 }
-                _ => tcx.emit_spanned_lint(
+                _ => tcx.emit_node_span_lint(
                     UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
                     tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
                     attr.span,
@@ -776,7 +776,7 @@ impl<'tcx> OnUnimplementedFormatString {
                             s if generics.params.iter().any(|param| param.name == s) => (),
                             s => {
                                 if self.is_diagnostic_namespace_variant {
-                                    tcx.emit_spanned_lint(
+                                    tcx.emit_node_span_lint(
                                         UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
                                         tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
                                         self.span,
diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs
index 6e68dee76a2..3289dfe343e 100644
--- a/compiler/rustc_trait_selection/src/traits/object_safety.rs
+++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs
@@ -161,7 +161,7 @@ fn lint_object_unsafe_trait(
 ) {
     // Using `CRATE_NODE_ID` is wrong, but it's hard to get a more precise id.
     // It's also hard to get a use site span, so we use the method definition span.
-    tcx.struct_span_lint_hir(
+    tcx.node_span_lint(
         WHERE_CLAUSES_OBJECT_SAFETY,
         hir::CRATE_HIR_ID,
         span,
diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
index b37d9714ddd..bfc6937a3eb 100644
--- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
@@ -387,7 +387,7 @@ fn report_conflicting_impls<'tcx>(
     let impl_span = tcx.def_span(impl_def_id);
 
     // Work to be done after we've built the DiagnosticBuilder. We have to define it
-    // now because the struct_lint methods don't return back the DiagnosticBuilder
+    // now because the lint emit methods don't return back the DiagnosticBuilder
     // that's passed in.
     fn decorate<'tcx>(
         tcx: TyCtxt<'tcx>,
@@ -462,7 +462,7 @@ fn report_conflicting_impls<'tcx>(
                 FutureCompatOverlapErrorKind::Issue33140 => ORDER_DEPENDENT_TRAIT_OBJECTS,
                 FutureCompatOverlapErrorKind::LeakCheck => COHERENCE_LEAK_CHECK,
             };
-            tcx.struct_span_lint_hir(
+            tcx.node_span_lint(
                 lint,
                 tcx.local_def_id_to_hir_id(impl_def_id),
                 impl_span,