Skip to content
7 changes: 6 additions & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2698,7 +2698,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {

let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);

tcx.emit_node_span_lint(UNUSED_MUT, lint_root, span, VarNeedNotMut { span: mut_span })
tcx.emit_diag_node_span_lint(
UNUSED_MUT,
lint_root,
span,
VarNeedNotMut { span: mut_span },
)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) struct GenericDoesNotLiveLongEnough {
pub span: Span,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("variable does not need to be mutable")]
pub(crate) struct VarNeedNotMut {
#[suggestion(
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_errors::codes::*;
use rustc_errors::{
Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level, msg,
};
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_middle::ty::layout::LayoutError;
use rustc_middle::ty::{FloatTy, Ty};
use rustc_span::{Span, Symbol};
Expand Down Expand Up @@ -1164,7 +1164,7 @@ pub(crate) struct XcrunSdkPathWarning {
pub stderr: String,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("enabling the `neon` target feature on the current target is unsound due to ABI issues")]
pub(crate) struct Aarch64SoftfloatNeon;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub(crate) fn from_target_feature_attr(
// For "neon" specifically, we emit an FCW instead of a hard error.
// See <https://github.com/rust-lang/rust/issues/134375>.
if tcx.sess.target.arch == Arch::AArch64 && name.as_str() == "neon" {
tcx.emit_node_span_lint(
tcx.emit_diag_node_span_lint(
AARCH64_SOFTFLOAT_NEON,
tcx.local_def_id_to_hir_id(did),
feature_span,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/const_eval/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ pub(super) fn lint<'tcx, L>(
lint: &'static rustc_session::lint::Lint,
decorator: impl FnOnce(Vec<errors::FrameNote>) -> L,
) where
L: for<'a> rustc_errors::LintDiagnostic<'a, ()>,
L: for<'a> rustc_errors::Diagnostic<'a, ()>,
{
let (span, frames) = get_span_and_frames(tcx, &machine.stack);

tcx.emit_node_span_lint(lint, machine.best_lint_scope(*tcx), span, decorator(frames));
tcx.emit_diag_node_span_lint(lint, machine.best_lint_scope(*tcx), span, decorator(frames));
}
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/const_eval/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
.level
.is_error();
let span = ecx.cur_span();
ecx.tcx.emit_node_span_lint(
ecx.tcx.emit_diag_node_span_lint(
rustc_session::lint::builtin::LONG_RUNNING_CONST_EVAL,
hir_id,
span,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_errors::{
Subdiagnostic, msg,
};
use rustc_hir::ConstContext;
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_middle::mir::interpret::{
CtfeProvenance, ExpectedKind, InterpErrorKind, InvalidMetaKind, InvalidProgramInfo,
Misalignment, Pointer, PointerKind, ResourceExhaustionInfo, UndefinedBehaviorInfo,
Expand Down Expand Up @@ -318,7 +318,7 @@ pub(crate) struct InteriorMutableBorrowEscaping {
pub kind: ConstContext,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("constant evaluation is taking a long time")]
#[note(
"this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ fn check_impl_items_against_trait<'tcx>(
}

if self_is_guaranteed_unsize_self && tcx.generics_require_sized_self(ty_trait_item.def_id) {
tcx.emit_node_span_lint(
tcx.emit_diag_node_span_lint(
rustc_lint_defs::builtin::DEAD_CODE,
tcx.local_def_id_to_hir_id(ty_impl_item.def_id.expect_local()),
tcx.def_span(ty_impl_item.def_id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ fn report_mismatched_rpitit_signature<'tcx>(
with_no_trimmed_paths!(with_types_for_signature!(format!("{return_ty}")));

let span = unmatched_bound.unwrap_or(span);
tcx.emit_node_span_lint(
tcx.emit_diag_node_span_lint(
if is_internal { REFINING_IMPL_TRAIT_INTERNAL } else { REFINING_IMPL_TRAIT_REACHABLE },
tcx.local_def_id_to_hir_id(impl_m_def_id.expect_local()),
span,
Expand Down Expand Up @@ -442,7 +442,7 @@ fn report_mismatched_rpitit_captures<'tcx>(
.sort_by_cached_key(|arg| !matches!(arg.kind(), ty::GenericArgKind::Lifetime(_)));
let suggestion = format!("use<{}>", trait_captured_args.iter().join(", "));

tcx.emit_node_span_lint(
tcx.emit_diag_node_span_lint(
if is_internal { REFINING_IMPL_TRAIT_INTERNAL } else { REFINING_IMPL_TRAIT_REACHABLE },
tcx.local_def_id_to_hir_id(impl_opaque_def_id),
use_bound_span,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rustc_hir::{AmbigArg, ItemKind, find_attr};
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin, TyCtxtInferExt};
use rustc_lint_defs::builtin::SHADOWING_SUPERTRAIT_ITEMS;
use rustc_macros::LintDiagnostic;
use rustc_macros::Diagnostic;
use rustc_middle::mir::interpret::ErrorHandled;
use rustc_middle::traits::solve::NoSolution;
use rustc_middle::ty::trait_def::TraitSpecializationKind;
Expand Down Expand Up @@ -797,7 +797,7 @@ fn lint_item_shadowing_supertrait_item<'tcx>(tcx: TyCtxt<'tcx>, trait_item_def_i
errors::SupertraitItemShadowee::Several { traits: traits.into(), spans: spans.into() }
};

tcx.emit_node_span_lint(
tcx.emit_diag_node_span_lint(
SHADOWING_SUPERTRAIT_ITEMS,
tcx.local_def_id_to_hir_id(trait_item_def_id),
tcx.def_span(trait_item_def_id),
Expand Down Expand Up @@ -2458,7 +2458,7 @@ fn lint_redundant_lifetimes<'tcx>(
&& outlives_env.free_region_map().sub_free_regions(tcx, victim, candidate)
{
shadowed.insert(victim);
tcx.emit_node_span_lint(
tcx.emit_diag_node_span_lint(
rustc_lint_defs::builtin::REDUNDANT_LIFETIMES,
tcx.local_def_id_to_hir_id(def_id.expect_local()),
tcx.def_span(def_id),
Expand All @@ -2469,7 +2469,7 @@ fn lint_redundant_lifetimes<'tcx>(
}
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("unnecessary lifetime parameter `{$victim}`")]
#[note("you can use the `{$candidate}` lifetime directly, in place of `{$victim}`")]
struct RedundantLifetimeArgsLint<'tcx> {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/coherence/orphan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,13 @@ fn lint_uncovered_ty_params<'tcx>(
let name = tcx.item_ident(param_def_id);

match local_ty {
Some(local_type) => tcx.emit_node_span_lint(
Some(local_type) => tcx.emit_diag_node_span_lint(
UNCOVERED_PARAM_IN_PROJECTION,
hir_id,
span,
errors::TyParamFirstLocalLint { span, note: (), param: name, local_type },
),
None => tcx.emit_node_span_lint(
None => tcx.emit_diag_node_span_lint(
UNCOVERED_PARAM_IN_PROJECTION,
hir_id,
span,
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_hir_analysis/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_errors::{
MultiSpan, listify, msg,
};
use rustc_hir::limit::Limit;
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_middle::ty::{self, Ty};
use rustc_span::{Ident, Span, Symbol};
pub(crate) mod wrong_number_of_generic_args;
Expand Down Expand Up @@ -888,7 +888,7 @@ pub(crate) enum ImplNotMarkedDefault {
},
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("this item cannot be used as its where bounds are not satisfied for the `Self` type")]
pub(crate) struct UselessImplItem;

Expand Down Expand Up @@ -1114,7 +1114,7 @@ pub(crate) enum LateBoundInApit {
},
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("unnecessary associated type bound for dyn-incompatible associated type")]
#[note(
"this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized`"
Expand All @@ -1124,7 +1124,7 @@ pub(crate) struct UnusedAssociatedTypeBounds {
pub span: Span,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("impl trait in impl method signature does not match trait method signature")]
#[note(
"add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate"
Expand All @@ -1149,7 +1149,7 @@ pub(crate) struct ReturnPositionImplTraitInTraitRefined {
pub return_ty: String,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("impl trait in impl method captures fewer lifetimes than in trait")]
#[note(
"add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate"
Expand Down Expand Up @@ -1467,7 +1467,7 @@ pub(crate) struct TyParamFirstLocal<'tcx> {
pub local_type: Ty<'tcx>,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)", code = E0210)]
#[note(
"implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type"
Expand Down Expand Up @@ -1499,7 +1499,7 @@ pub(crate) struct TyParamSome {
pub param: Ident,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("type parameter `{$param}` must be used as the type parameter for some local type (e.g., `MyStruct<{$param}>`)", code = E0210)]
#[note(
"implementing a foreign trait is only possible if at least one of the types for which it is implemented is local"
Expand Down Expand Up @@ -1805,7 +1805,7 @@ pub(crate) struct BadReturnTypeNotation {
pub span: Span,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("trait item `{$item}` from `{$subtrait}` shadows identically named item from supertrait")]
pub(crate) struct SupertraitItemShadowing {
pub item: Symbol,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
// FIXME(mgca): Ideally we would generalize the name of this lint to sth. like
// `unused_associated_item_bindings` since this can now also trigger on *const*
// projections / assoc *const* bindings.
tcx.emit_node_span_lint(
tcx.emit_diag_node_span_lint(
UNUSED_ASSOCIATED_TYPE_BOUNDS,
hir_id,
span,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_hir_typeck/src/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,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_node_span_lint(
fcx.tcx.emit_diag_node_span_lint(
lint,
self.expr.hir_id,
self.span,
Expand Down Expand Up @@ -1125,7 +1125,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
};

let lint = errors::LossyProvenancePtr2Int { expr_ty, cast_ty, sugg };
fcx.tcx.emit_node_span_lint(
fcx.tcx.emit_diag_node_span_lint(
lint::builtin::LOSSY_PROVENANCE_CASTS,
self.expr.hir_id,
self.span,
Expand All @@ -1141,7 +1141,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_node_span_lint(
fcx.tcx.emit_diag_node_span_lint(
lint::builtin::FUZZY_PROVENANCE_CASTS,
self.expr.hir_id,
self.span,
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_hir_typeck/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_errors::{
};
use rustc_hir as hir;
use rustc_hir::ExprKind;
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_middle::ty::{self, Ty};
use rustc_span::edition::{Edition, LATEST_STABLE_EDITION};
use rustc_span::source_map::Spanned;
Expand Down Expand Up @@ -215,7 +215,7 @@ pub(crate) struct MissingParenthesesInRange<'tcx> {
pub add_missing_parentheses: Option<AddMissingParenthesesInRange>,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
pub(crate) enum NeverTypeFallbackFlowingIntoUnsafe {
#[help("specify the type explicitly")]
#[diag("never type fallback affects this call to an `unsafe` function")]
Expand Down Expand Up @@ -249,7 +249,7 @@ pub(crate) enum NeverTypeFallbackFlowingIntoUnsafe {
},
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[help("specify the types explicitly")]
#[diag("this function depends on never type fallback being `()`")]
pub(crate) struct DependencyOnUnitNeverTypeFallback<'tcx> {
Expand Down Expand Up @@ -372,7 +372,7 @@ impl Subdiagnostic for TypeMismatchFruTypo {
}
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("strict provenance disallows casting integer `{$expr_ty}` to pointer `{$cast_ty}`")]
#[help(
"if you can't comply with strict provenance and don't have a pointer with the correct provenance you can use `std::ptr::with_exposed_provenance()` instead"
Expand Down Expand Up @@ -411,7 +411,7 @@ pub(crate) struct LossyProvenanceInt2PtrSuggestion {
pub hi: Span,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag(
"under strict provenance it is considered bad style to cast pointer `{$expr_ty}` to integer `{$cast_ty}`"
)]
Expand Down Expand Up @@ -769,7 +769,7 @@ pub(crate) struct SuggestPtrNullMut {
pub span: Span,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag(
"trivial {$numeric ->
[true] numeric cast
Expand Down Expand Up @@ -1109,7 +1109,7 @@ pub(crate) struct InnerItem {
pub span: Span,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("can't reference `Self` constructor from outer item")]
pub(crate) struct SelfCtorFromOuterItemLint {
#[label(
Expand Down Expand Up @@ -1214,7 +1214,7 @@ pub(crate) struct ReplaceCommaWithSemicolon {
pub descr: &'static str,
}

#[derive(LintDiagnostic)]
#[derive(Diagnostic)]
#[diag("trait item `{$item}` from `{$subtrait}` shadows identically named item from supertrait")]
pub(crate) struct SupertraitItemShadowing {
pub item: Symbol,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_typeck/src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
let sugg = self.try_to_suggest_annotations(&[root_vid], coercion_graph);

for (hir_id, span, reason) in affected_unsafe_infer_vars {
self.tcx.emit_node_span_lint(
self.tcx.emit_diag_node_span_lint(
lint::builtin::NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE,
hir_id,
span,
Expand Down Expand Up @@ -304,7 +304,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
{
self.adjust_fulfillment_error_for_expr_obligation(never_error);
let sugg = self.try_to_suggest_annotations(diverging_vids, coercions);
self.tcx.emit_node_span_lint(
self.tcx.emit_diag_node_span_lint(
lint::builtin::DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK,
self.tcx.local_def_id_to_hir_id(self.body_id),
self.tcx.def_span(self.body_id),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
});
return (Ty::new_error(self.tcx, guar), res);
} else {
self.tcx.emit_node_span_lint(
self.tcx.emit_diag_node_span_lint(
SELF_CONSTRUCTOR_FROM_OUTER_ITEM,
hir_id,
path_span,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/method/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
SupertraitItemShadowee::Several { traits: traits.into(), spans: spans.into() }
};

self.tcx.emit_node_span_lint(
self.tcx.emit_diag_node_span_lint(
RESOLVING_TO_ITEMS_SHADOWING_SUPERTRAIT_ITEMS,
segment.hir_id,
segment.ident.span,
Expand Down
Loading
Loading