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`
This commit is contained in:
commit
0011fac90d
96 changed files with 353 additions and 376 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue