mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Rename TyCtxt::emit_spanned_lint
as TyCtxt::emit_node_span_lint
.
This commit is contained in:
parent
82ca070c16
commit
e164cf30f8
@ -415,7 +415,7 @@ fn do_mir_borrowck<'tcx>(
|
||||
|
||||
let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
|
||||
|
||||
tcx.emit_spanned_lint(UNUSED_MUT, lint_root, span, VarNeedNotMut { span: mut_span })
|
||||
tcx.emit_node_span_lint(UNUSED_MUT, lint_root, span, VarNeedNotMut { span: mut_span })
|
||||
}
|
||||
|
||||
let tainted_by_errors = mbcx.emit_errors();
|
||||
|
@ -175,7 +175,7 @@ pub(super) fn lint<'tcx, 'mir, L>(
|
||||
{
|
||||
let (span, frames) = get_span_and_frames(tcx, machine);
|
||||
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
lint,
|
||||
// We use the root frame for this so the crate that defines the const defines whether the
|
||||
// lint is emitted.
|
||||
|
@ -611,7 +611,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
||||
.0
|
||||
.is_error();
|
||||
let span = ecx.cur_span();
|
||||
ecx.tcx.emit_spanned_lint(
|
||||
ecx.tcx.emit_node_span_lint(
|
||||
rustc_session::lint::builtin::LONG_RUNNING_CONST_EVAL,
|
||||
hir_id,
|
||||
span,
|
||||
|
@ -220,7 +220,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
let def_id = projection_bound.projection_def_id();
|
||||
def_ids.remove(&def_id);
|
||||
if tcx.generics_require_sized_self(def_id) {
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
UNUSED_ASSOCIATED_TYPE_BOUNDS,
|
||||
hir_id,
|
||||
*span,
|
||||
|
@ -283,7 +283,7 @@ fn report_mismatched_rpitit_signature<'tcx>(
|
||||
});
|
||||
|
||||
let span = unmatched_bound.unwrap_or(span);
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
REFINING_IMPL_TRAIT,
|
||||
tcx.local_def_id_to_hir_id(impl_m_def_id.expect_local()),
|
||||
span,
|
||||
|
@ -88,7 +88,7 @@ fn handle_static_mut_ref(
|
||||
"shared ",
|
||||
)
|
||||
};
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
STATIC_MUT_REF,
|
||||
hir_id,
|
||||
span,
|
||||
|
@ -587,7 +587,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
||||
};
|
||||
let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
|
||||
let cast_ty = fcx.resolve_vars_if_possible(self.cast_ty);
|
||||
fcx.tcx.emit_spanned_lint(
|
||||
fcx.tcx.emit_node_span_lint(
|
||||
lint,
|
||||
self.expr.hir_id,
|
||||
self.span,
|
||||
@ -900,7 +900,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
||||
let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
|
||||
let cast_ty = fcx.resolve_vars_if_possible(self.cast_ty);
|
||||
|
||||
fcx.tcx.emit_spanned_lint(
|
||||
fcx.tcx.emit_node_span_lint(
|
||||
lint::builtin::CENUM_IMPL_DROP_CAST,
|
||||
self.expr.hir_id,
|
||||
self.span,
|
||||
@ -934,7 +934,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
||||
};
|
||||
|
||||
let lint = errors::LossyProvenancePtr2Int { expr_ty, cast_ty, sugg };
|
||||
fcx.tcx.emit_spanned_lint(
|
||||
fcx.tcx.emit_node_span_lint(
|
||||
lint::builtin::LOSSY_PROVENANCE_CASTS,
|
||||
self.expr.hir_id,
|
||||
self.span,
|
||||
@ -950,7 +950,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
||||
let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
|
||||
let cast_ty = fcx.resolve_vars_if_possible(self.cast_ty);
|
||||
let lint = errors::LossyProvenanceInt2Ptr { expr_ty, cast_ty, sugg };
|
||||
fcx.tcx.emit_spanned_lint(
|
||||
fcx.tcx.emit_node_span_lint(
|
||||
lint::builtin::FUZZY_PROVENANCE_CASTS,
|
||||
self.expr.hir_id,
|
||||
self.span,
|
||||
|
@ -116,7 +116,7 @@ impl<'tcx> LateLintPass<'tcx> for AsyncFnInTrait {
|
||||
def.owner_id.def_id,
|
||||
" + Send",
|
||||
);
|
||||
cx.tcx.emit_spanned_lint(
|
||||
cx.tcx.emit_node_span_lint(
|
||||
ASYNC_FN_IN_TRAIT,
|
||||
item.hir_id(),
|
||||
async_span,
|
||||
|
@ -29,7 +29,7 @@ fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
|
||||
{
|
||||
let rationale = expectation.reason.map(|rationale| ExpectationNote { rationale });
|
||||
let note = expectation.is_unfulfilled_lint_expectations.then_some(());
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
UNFULFILLED_LINT_EXPECTATIONS,
|
||||
*hir_id,
|
||||
expectation.emission_span,
|
||||
|
@ -161,7 +161,7 @@ impl ClashingExternDeclarations {
|
||||
sub,
|
||||
}
|
||||
};
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
CLASHING_EXTERN_DECLARATIONS,
|
||||
this_fi.hir_id(),
|
||||
mismatch_label,
|
||||
|
@ -247,7 +247,7 @@ pub fn explain_lint_level_source(
|
||||
///
|
||||
/// If you are looking to implement a lint, look for higher level functions,
|
||||
/// for example:
|
||||
/// - [`TyCtxt::emit_spanned_lint`]
|
||||
/// - [`TyCtxt::emit_node_span_lint`]
|
||||
/// - [`TyCtxt::node_span_lint`]
|
||||
/// - [`TyCtxt::emit_node_lint`]
|
||||
/// - [`TyCtxt::node_lint`]
|
||||
|
@ -2077,7 +2077,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
/// Emit a lint at `span` from a lint struct (some type that implements `DecorateLint`,
|
||||
/// typically generated by `#[derive(LintDiagnostic)]`).
|
||||
#[track_caller]
|
||||
pub fn emit_spanned_lint(
|
||||
pub fn emit_node_span_lint(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
hir_id: HirId,
|
||||
|
@ -599,7 +599,7 @@ impl UnsafeOpKind {
|
||||
// FIXME: ideally we would want to trim the def paths, but this is not
|
||||
// feasible with the current lint emission API (see issue #106126).
|
||||
match self {
|
||||
CallToUnsafeFunction(Some(did)) => tcx.emit_spanned_lint(
|
||||
CallToUnsafeFunction(Some(did)) => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -609,7 +609,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
CallToUnsafeFunction(None) => tcx.emit_spanned_lint(
|
||||
CallToUnsafeFunction(None) => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -618,7 +618,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
UseOfInlineAssembly => tcx.emit_spanned_lint(
|
||||
UseOfInlineAssembly => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -627,7 +627,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
InitializingTypeWith => tcx.emit_spanned_lint(
|
||||
InitializingTypeWith => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -636,7 +636,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
UseOfMutableStatic => tcx.emit_spanned_lint(
|
||||
UseOfMutableStatic => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -645,7 +645,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
UseOfExternStatic => tcx.emit_spanned_lint(
|
||||
UseOfExternStatic => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -654,7 +654,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
DerefOfRawPointer => tcx.emit_spanned_lint(
|
||||
DerefOfRawPointer => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -663,7 +663,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
AccessToUnionField => tcx.emit_spanned_lint(
|
||||
AccessToUnionField => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -672,7 +672,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
MutationOfLayoutConstrainedField => tcx.emit_spanned_lint(
|
||||
MutationOfLayoutConstrainedField => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -681,7 +681,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
BorrowOfLayoutConstrainedField => tcx.emit_spanned_lint(
|
||||
BorrowOfLayoutConstrainedField => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -690,7 +690,7 @@ impl UnsafeOpKind {
|
||||
unsafe_not_inherited_note,
|
||||
},
|
||||
),
|
||||
CallToFunctionWith { function, missing, build_enabled } => tcx.emit_spanned_lint(
|
||||
CallToFunctionWith { function, missing, build_enabled } => tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
hir_id,
|
||||
span,
|
||||
@ -941,7 +941,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
|
||||
warnings.sort_by_key(|w| w.block_span);
|
||||
for UnusedUnsafeWarning { hir_id, block_span, enclosing_unsafe } in warnings {
|
||||
let block_span = tcx.sess.source_map().guess_head_span(block_span);
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
UNUSED_UNSAFE,
|
||||
hir_id,
|
||||
block_span,
|
||||
|
@ -53,7 +53,7 @@ fn check_recursion<'tcx>(
|
||||
|
||||
let sp = tcx.def_span(def_id);
|
||||
let hir_id = tcx.local_def_id_to_hir_id(def_id);
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
UNCONDITIONAL_RECURSION,
|
||||
hir_id,
|
||||
sp,
|
||||
|
@ -539,7 +539,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
|
||||
let span_end = prefix.last().unwrap().unwrap().0;
|
||||
let span = span_start.to(span_end);
|
||||
let count = prefix.len();
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
IRREFUTABLE_LET_PATTERNS,
|
||||
self.lint_level,
|
||||
span,
|
||||
@ -558,7 +558,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
|
||||
let span_end = suffix.last().unwrap().unwrap().0;
|
||||
let span = span_start.to(span_end);
|
||||
let count = suffix.len();
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
IRREFUTABLE_LET_PATTERNS,
|
||||
self.lint_level,
|
||||
span,
|
||||
@ -814,7 +814,7 @@ fn check_for_bindings_named_same_as_variants(
|
||||
{
|
||||
let variant_count = edef.variants().len();
|
||||
let ty_path = with_no_trimmed_paths!(cx.tcx.def_path_str(edef.did()));
|
||||
cx.tcx.emit_spanned_lint(
|
||||
cx.tcx.emit_node_span_lint(
|
||||
BINDINGS_WITH_VARIANT_NAME,
|
||||
cx.lint_level,
|
||||
pat.span,
|
||||
@ -856,7 +856,7 @@ fn report_irrefutable_let_patterns(
|
||||
) {
|
||||
macro_rules! emit_diag {
|
||||
($lint:tt) => {{
|
||||
tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, id, span, $lint { count });
|
||||
tcx.emit_node_span_lint(IRREFUTABLE_LET_PATTERNS, id, span, $lint { count });
|
||||
}};
|
||||
}
|
||||
|
||||
@ -876,7 +876,7 @@ fn report_unreachable_pattern<'p, 'tcx>(
|
||||
span: Span,
|
||||
catchall: Option<Span>,
|
||||
) {
|
||||
cx.tcx.emit_spanned_lint(
|
||||
cx.tcx.emit_node_span_lint(
|
||||
UNREACHABLE_PATTERNS,
|
||||
hir_id,
|
||||
span,
|
||||
|
@ -214,7 +214,7 @@ impl<'tcx> ConstToPat<'tcx> {
|
||||
if let Some(mir_structural_match_violation) = mir_structural_match_violation {
|
||||
match non_sm_ty.kind() {
|
||||
ty::Adt(..) if mir_structural_match_violation => {
|
||||
self.tcx().emit_spanned_lint(
|
||||
self.tcx().emit_node_span_lint(
|
||||
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
|
||||
self.id,
|
||||
self.span,
|
||||
@ -233,7 +233,7 @@ impl<'tcx> ConstToPat<'tcx> {
|
||||
} else if !have_valtree && !self.saw_const_match_lint.get() {
|
||||
// The only way valtree construction can fail without the structural match
|
||||
// checker finding a violation is if there is a pointer somewhere.
|
||||
self.tcx().emit_spanned_lint(
|
||||
self.tcx().emit_node_span_lint(
|
||||
lint::builtin::POINTER_STRUCTURAL_MATCH,
|
||||
self.id,
|
||||
self.span,
|
||||
@ -244,7 +244,7 @@ impl<'tcx> ConstToPat<'tcx> {
|
||||
// Always check for `PartialEq`, even if we emitted other lints. (But not if there were
|
||||
// any errors.) This ensures it shows up in cargo's future-compat reports as well.
|
||||
if !self.type_has_partial_eq_impl(cv.ty()) {
|
||||
self.tcx().emit_spanned_lint(
|
||||
self.tcx().emit_node_span_lint(
|
||||
lint::builtin::CONST_PATTERNS_WITHOUT_PARTIAL_EQ,
|
||||
self.id,
|
||||
self.span,
|
||||
@ -319,7 +319,7 @@ impl<'tcx> ConstToPat<'tcx> {
|
||||
let kind = match ty.kind() {
|
||||
ty::Float(_) => {
|
||||
self.saw_const_match_lint.set(true);
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
lint::builtin::ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
|
||||
id,
|
||||
span,
|
||||
@ -339,7 +339,7 @@ impl<'tcx> ConstToPat<'tcx> {
|
||||
ty::Adt(..) if !self.type_marked_structural(ty) && self.behind_reference.get() => {
|
||||
if self.saw_const_match_error.get().is_none() && !self.saw_const_match_lint.get() {
|
||||
self.saw_const_match_lint.set(true);
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
|
||||
id,
|
||||
span,
|
||||
@ -435,7 +435,7 @@ impl<'tcx> ConstToPat<'tcx> {
|
||||
&& !self.saw_const_match_lint.get()
|
||||
{
|
||||
self.saw_const_match_lint.set(true);
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
lint::builtin::INDIRECT_STRUCTURAL_MATCH,
|
||||
self.id,
|
||||
span,
|
||||
@ -516,7 +516,7 @@ impl<'tcx> ConstToPat<'tcx> {
|
||||
&& let Some(non_sm_ty) = traits::search_for_structural_match_violation(span, tcx, ty)
|
||||
{
|
||||
self.saw_const_match_lint.set(true);
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
lint::builtin::NONTRIVIAL_STRUCTURAL_MATCH,
|
||||
id,
|
||||
span,
|
||||
|
@ -100,7 +100,7 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> {
|
||||
&& let Some((lint_root, span, item)) =
|
||||
self.should_lint_const_item_usage(lhs, def_id, loc)
|
||||
{
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
CONST_ITEM_MUTATION,
|
||||
lint_root,
|
||||
span,
|
||||
@ -145,7 +145,7 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> {
|
||||
if let Some((lint_root, span, item)) =
|
||||
self.should_lint_const_item_usage(place, def_id, lint_loc)
|
||||
{
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
CONST_ITEM_MUTATION,
|
||||
lint_root,
|
||||
span,
|
||||
|
@ -527,7 +527,7 @@ fn report_unused_unsafe(tcx: TyCtxt<'_>, kind: UnusedUnsafe, id: HirId) {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
tcx.emit_spanned_lint(UNUSED_UNSAFE, id, span, errors::UnusedUnsafe { span, nested_parent });
|
||||
tcx.emit_node_span_lint(UNUSED_UNSAFE, id, span, errors::UnusedUnsafe { span, nested_parent });
|
||||
}
|
||||
|
||||
pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
@ -577,7 +577,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
});
|
||||
}
|
||||
UnsafetyViolationKind::UnsafeFn => {
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
UNSAFE_OP_IN_UNSAFE_FN,
|
||||
lint_root,
|
||||
source_info.span,
|
||||
|
@ -278,7 +278,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||
|
||||
fn report_assert_as_lint(&self, source_info: &SourceInfo, lint: AssertLint<impl Debug>) {
|
||||
if let Some(lint_root) = self.lint_root(*source_info) {
|
||||
self.tcx.emit_spanned_lint(lint.lint(), lint_root, source_info.span, lint);
|
||||
self.tcx.emit_node_span_lint(lint.lint(), lint_root, source_info.span, lint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2071,7 +2071,7 @@ fn check_must_not_suspend_def(
|
||||
span: data.source_span,
|
||||
reason: s.as_str().to_string(),
|
||||
});
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
rustc_session::lint::builtin::MUST_NOT_SUSPEND,
|
||||
hir_id,
|
||||
data.source_span,
|
||||
|
@ -112,7 +112,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
|
||||
let span = terminator.source_info.span;
|
||||
|
||||
let foreign = fn_def_id.is_some();
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
FFI_UNWIND_CALLS,
|
||||
lint_root,
|
||||
span,
|
||||
|
@ -185,7 +185,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> {
|
||||
ret,
|
||||
);
|
||||
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
FUNCTION_ITEM_REFERENCES,
|
||||
lint_root,
|
||||
span,
|
||||
|
@ -714,7 +714,7 @@ impl<'a, 'tcx> MirUsedCollector<'a, 'tcx> {
|
||||
// but correct span? This would make the lint at least accept crate-level lint attributes.
|
||||
return;
|
||||
};
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
LARGE_ASSIGNMENTS,
|
||||
lint_root,
|
||||
span,
|
||||
|
@ -246,13 +246,13 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name))
|
||||
{
|
||||
match attr.style {
|
||||
ast::AttrStyle::Outer => self.tcx.emit_spanned_lint(
|
||||
ast::AttrStyle::Outer => self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
errors::OuterCrateLevelAttr,
|
||||
),
|
||||
ast::AttrStyle::Inner => self.tcx.emit_spanned_lint(
|
||||
ast::AttrStyle::Inner => self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -274,7 +274,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
fn inline_attr_str_error_with_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -283,7 +283,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
fn inline_attr_str_error_without_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -304,7 +304,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
/// Checks if `#[diagnostic::on_unimplemented]` is applied to a trait definition
|
||||
fn check_diagnostic_on_unimplemented(&self, attr_span: Span, hir_id: HirId, target: Target) {
|
||||
if !matches!(target, Target::Trait) {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr_span,
|
||||
@ -320,7 +320,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
| Target::Closure
|
||||
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => true,
|
||||
Target::Method(MethodKind::Trait { body: false }) | Target::ForeignFn => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -333,7 +333,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
// accidentally, to be compatible with crates depending on them, we can't throw an
|
||||
// error here.
|
||||
Target::AssocConst => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -366,7 +366,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
|
||||
// function prototypes can't be covered
|
||||
Target::Method(MethodKind::Trait { body: false }) | Target::ForeignFn => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -376,7 +376,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
Target::Mod | Target::ForeignMod | Target::Impl | Target::Trait => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -386,7 +386,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
Target::Expression | Target::Statement | Target::Arm => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -413,7 +413,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
allowed_target: Target,
|
||||
) {
|
||||
if target != allowed_target {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -630,7 +630,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
// FIXME: #[target_feature] was previously erroneously allowed on statements and some
|
||||
// crates used this, so only emit a warning.
|
||||
Target::Statement => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -769,7 +769,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
return false;
|
||||
}
|
||||
if let Err(entry) = aliases.try_insert(doc_alias_str.to_owned(), span) {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
span,
|
||||
@ -914,7 +914,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
meta.span(),
|
||||
@ -937,7 +937,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
target: Target,
|
||||
) -> bool {
|
||||
if target != Target::ExternCrate {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
meta.span(),
|
||||
@ -951,7 +951,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
if self.tcx.extern_mod_stmt_cnum(hir_id.owner).is_none() {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
meta.span(),
|
||||
@ -996,7 +996,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
.then_some(errors::AttrCrateLevelOnlySugg {
|
||||
attr: attr.span.with_lo(bang_span).with_hi(bang_span),
|
||||
});
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
meta.span(),
|
||||
@ -1016,7 +1016,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
match (i_meta.name_or_empty(), i_meta.meta_item()) {
|
||||
(sym::attr | sym::no_crate_inject, _) => {}
|
||||
(_, Some(m)) => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
i_meta.span(),
|
||||
@ -1027,7 +1027,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
is_valid = false;
|
||||
}
|
||||
(_, None) => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
i_meta.span(),
|
||||
@ -1038,7 +1038,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
meta.span(),
|
||||
@ -1055,7 +1055,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
if meta.meta_item_list().is_some() {
|
||||
true
|
||||
} else {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
meta.span(),
|
||||
@ -1188,7 +1188,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
_ => {
|
||||
let path = rustc_ast_pretty::pprust::path_to_string(&i_meta.path);
|
||||
if i_meta.has_name(sym::spotlight) {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
i_meta.span,
|
||||
@ -1204,7 +1204,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
};
|
||||
// If there are multiple attributes, the suggestion would suggest
|
||||
// deleting all of them, which is incorrect.
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
i_meta.span,
|
||||
@ -1219,7 +1219,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
},
|
||||
);
|
||||
} else {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
i_meta.span,
|
||||
@ -1230,7 +1230,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
meta.span(),
|
||||
@ -1343,7 +1343,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
_ => "a",
|
||||
};
|
||||
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -1380,7 +1380,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
_ => {
|
||||
// FIXME: #[cold] was previously allowed on non-functions and some crates used
|
||||
// this, so only emit a warning.
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -1400,7 +1400,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
return;
|
||||
}
|
||||
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -1424,14 +1424,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
// used this, so only emit a warning.
|
||||
let attr_span = matches!(target, Target::ForeignMod).then_some(attr.span);
|
||||
if let Some(s) = attr.value_str() {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
errors::LinkName { span, attr_span, value: s.as_str() },
|
||||
);
|
||||
} else {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -1710,7 +1710,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
_ => {
|
||||
// FIXME: #[link_section] was previously allowed on non-functions/statics and some
|
||||
// crates used this, so only emit a warning.
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -1741,7 +1741,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
Target::ForeignStatic => "static",
|
||||
_ => unreachable!(),
|
||||
};
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -1751,7 +1751,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
_ => {
|
||||
// FIXME: #[no_mangle] was previously allowed on non-functions/statics and some
|
||||
// crates used this, so only emit a warning.
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -1929,7 +1929,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
return false;
|
||||
}))
|
||||
{
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
CONFLICTING_REPR_HINTS,
|
||||
hir_id,
|
||||
hint_spans.collect::<Vec<Span>>(),
|
||||
@ -2171,7 +2171,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
fn check_deprecated(&self, hir_id: HirId, attr: &Attribute, _span: Span, target: Target) {
|
||||
match target {
|
||||
Target::Closure | Target::Expression | Target::Statement | Target::Arm => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -2187,7 +2187,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
match target {
|
||||
Target::ExternCrate | Target::Mod => {}
|
||||
_ => {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -2199,7 +2199,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
|
||||
fn check_macro_export(&self, hir_id: HirId, attr: &Attribute, target: Target) {
|
||||
if target != Target::MacroDef {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -2209,7 +2209,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
&& !meta_item_list.is_empty()
|
||||
{
|
||||
if meta_item_list.len() > 1 {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_MACRO_EXPORT_ARGUMENTS,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -2217,7 +2217,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
);
|
||||
} else {
|
||||
if meta_item_list[0].name_or_empty() != sym::local_inner_macros {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INVALID_MACRO_EXPORT_ARGUMENTS,
|
||||
hir_id,
|
||||
meta_item_list[0].span(),
|
||||
@ -2234,7 +2234,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
let is_decl_macro = !macro_definition.macro_rules;
|
||||
|
||||
if is_decl_macro {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -2276,7 +2276,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
return;
|
||||
};
|
||||
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
@ -2609,7 +2609,7 @@ fn check_duplicates(
|
||||
} else {
|
||||
(attr.span, *entry.get())
|
||||
};
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
this,
|
||||
|
@ -199,7 +199,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
|
||||
&& !assign.span.from_expansion()
|
||||
{
|
||||
let is_field_assign = matches!(lhs.kind, hir::ExprKind::Field(..));
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
lint::builtin::DEAD_CODE,
|
||||
assign.hir_id,
|
||||
assign.span,
|
||||
@ -899,7 +899,7 @@ impl<'tcx> DeadVisitor<'tcx> {
|
||||
};
|
||||
|
||||
let hir_id = tcx.local_def_id_to_hir_id(first_item.def_id);
|
||||
self.tcx.emit_spanned_lint(DEAD_CODE, hir_id, MultiSpan::from_spans(spans), diag);
|
||||
self.tcx.emit_node_span_lint(DEAD_CODE, hir_id, MultiSpan::from_spans(spans), diag);
|
||||
}
|
||||
|
||||
fn warn_multiple(
|
||||
|
@ -1285,7 +1285,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
// that we do not emit the same warning twice if the uninhabited type
|
||||
// is indeed `!`.
|
||||
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNREACHABLE_CODE,
|
||||
expr_id,
|
||||
expr_span,
|
||||
@ -1446,7 +1446,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||
if self.used_on_entry(entry_ln, var) {
|
||||
if !self.live_on_entry(entry_ln, var) {
|
||||
if let Some(name) = self.should_warn(var) {
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNUSED_ASSIGNMENTS,
|
||||
var_hir_id,
|
||||
vec![span],
|
||||
@ -1456,7 +1456,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||
}
|
||||
} else {
|
||||
if let Some(name) = self.should_warn(var) {
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNUSED_VARIABLES,
|
||||
var_hir_id,
|
||||
vec![span],
|
||||
@ -1478,7 +1478,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||
if !self.live_on_entry(ln, var)
|
||||
&& let Some(name) = self.should_warn(var)
|
||||
{
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNUSED_ASSIGNMENTS,
|
||||
hir_id,
|
||||
spans,
|
||||
@ -1552,7 +1552,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||
if ln == self.exit_ln { false } else { self.assigned_on_exit(ln, var) };
|
||||
|
||||
if is_assigned {
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNUSED_VARIABLES,
|
||||
first_hir_id,
|
||||
hir_ids_and_spans
|
||||
@ -1574,7 +1574,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||
span.with_hi(BytePos(span.hi().0 + 1))
|
||||
})
|
||||
.collect();
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNUSED_VARIABLES,
|
||||
first_hir_id,
|
||||
hir_ids_and_spans.iter().map(|(_, pat_span, _)| *pat_span).collect::<Vec<_>>(),
|
||||
@ -1599,7 +1599,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||
let non_shorthands =
|
||||
non_shorthands.into_iter().map(|(_, pat_span, _)| pat_span).collect();
|
||||
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNUSED_VARIABLES,
|
||||
first_hir_id,
|
||||
hir_ids_and_spans
|
||||
@ -1638,7 +1638,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNUSED_VARIABLES,
|
||||
first_hir_id,
|
||||
hir_ids_and_spans
|
||||
@ -1690,7 +1690,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||
if !self.live_on_exit(ln, var)
|
||||
&& let Some(name) = self.should_warn(var)
|
||||
{
|
||||
self.ir.tcx.emit_spanned_lint(
|
||||
self.ir.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNUSED_ASSIGNMENTS,
|
||||
hir_id,
|
||||
spans,
|
||||
|
@ -70,7 +70,7 @@ fn check_abi(tcx: TyCtxt<'_>, def_id: LocalDefId, abi: Abi) {
|
||||
if abi == Abi::Rust {
|
||||
let hir_id = tcx.local_def_id_to_hir_id(def_id);
|
||||
let span = tcx.def_span(def_id);
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
UNDEFINED_NAKED_FUNCTION_ABI,
|
||||
hir_id,
|
||||
span,
|
||||
|
@ -122,7 +122,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
||||
|
||||
if matches!(kind, AnnotationKind::Prohibited | AnnotationKind::DeprecationProhibited) {
|
||||
let hir_id = self.tcx.local_def_id_to_hir_id(def_id);
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
USELESS_DEPRECATED,
|
||||
hir_id,
|
||||
*span,
|
||||
@ -739,7 +739,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
|
||||
// do not lint when the trait isn't resolved, since resolution error should
|
||||
// be fixed first
|
||||
if t.path.res != Res::Err && c.fully_stable {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
INEFFECTIVE_UNSTABLE_TRAIT_IMPL,
|
||||
item.hir_id(),
|
||||
span,
|
||||
@ -1073,7 +1073,7 @@ fn unnecessary_partially_stable_feature_lint(
|
||||
implies: Symbol,
|
||||
since: Symbol,
|
||||
) {
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
lint::builtin::STABLE_FEATURES,
|
||||
hir::CRATE_HIR_ID,
|
||||
span,
|
||||
@ -1096,7 +1096,7 @@ fn unnecessary_stable_feature_lint(
|
||||
if since.as_str() == VERSION_PLACEHOLDER {
|
||||
since = sym::env_CFG_RELEASE;
|
||||
}
|
||||
tcx.emit_spanned_lint(
|
||||
tcx.emit_node_span_lint(
|
||||
lint::builtin::STABLE_FEATURES,
|
||||
hir::CRATE_HIR_ID,
|
||||
span,
|
||||
|
@ -158,7 +158,7 @@ pub(crate) fn lint_nonexhaustive_missing_variants<'a, 'p, 'tcx>(
|
||||
// is not exhaustive enough.
|
||||
//
|
||||
// NB: The partner lint for structs lives in `compiler/rustc_hir_analysis/src/check/pat.rs`.
|
||||
rcx.tcx.emit_spanned_lint(
|
||||
rcx.tcx.emit_node_span_lint(
|
||||
NON_EXHAUSTIVE_OMITTED_PATTERNS,
|
||||
rcx.match_lint_level,
|
||||
rcx.scrut_span,
|
||||
|
@ -1001,7 +1001,7 @@ impl<'p, 'tcx> TypeCx for RustcMatchCheckCtxt<'p, 'tcx> {
|
||||
.map(|span| errors::Overlap { range: overlap_as_pat.clone(), span })
|
||||
.collect();
|
||||
let pat_span = pat.data().unwrap().span;
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
lint::builtin::OVERLAPPING_RANGE_ENDPOINTS,
|
||||
self.match_lint_level,
|
||||
pat_span,
|
||||
|
@ -1399,7 +1399,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
|
||||
|
||||
fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
|
||||
if self.leaks_private_dep(def_id) {
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES,
|
||||
self.tcx.local_def_id_to_hir_id(self.item_def_id),
|
||||
self.tcx.def_span(self.item_def_id.to_def_id()),
|
||||
@ -1456,7 +1456,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
|
||||
} else {
|
||||
lint::builtin::PRIVATE_BOUNDS
|
||||
};
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
lint,
|
||||
self.tcx.local_def_id_to_hir_id(self.item_def_id),
|
||||
span,
|
||||
@ -1543,7 +1543,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> {
|
||||
if reachable_at_vis.is_public() && reexported_at_vis != reachable_at_vis {
|
||||
let hir_id = self.tcx.local_def_id_to_hir_id(def_id);
|
||||
let span = self.tcx.def_span(def_id.to_def_id());
|
||||
self.tcx.emit_spanned_lint(
|
||||
self.tcx.emit_node_span_lint(
|
||||
lint::builtin::UNNAMEABLE_TYPES,
|
||||
hir_id,
|
||||
span,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user