diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 2fc057ae38823..259c6cd7728ce 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -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 }, + ) } } } diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs index 7bde534dafd20..eaa41ce1caacf 100644 --- a/compiler/rustc_borrowck/src/session_diagnostics.rs +++ b/compiler/rustc_borrowck/src/session_diagnostics.rs @@ -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( diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index 74f7829ace95a..be1965f674911 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -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}; @@ -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; diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs index e9209657984e0..d7f871527e3d1 100644 --- a/compiler/rustc_codegen_ssa/src/target_features.rs +++ b/compiler/rustc_codegen_ssa/src/target_features.rs @@ -75,7 +75,7 @@ pub(crate) fn from_target_feature_attr( // For "neon" specifically, we emit an FCW instead of a hard error. // See . 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, diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs index 69aef3b047df2..7efef74e70aa3 100644 --- a/compiler/rustc_const_eval/src/const_eval/error.rs +++ b/compiler/rustc_const_eval/src/const_eval/error.rs @@ -252,9 +252,9 @@ pub(super) fn lint<'tcx, L>( lint: &'static rustc_session::lint::Lint, decorator: impl FnOnce(Vec) -> 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)); } diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 025c59747eaf7..eac154f0602ca 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -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, diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index 6a33a9ae0597c..cdc02ae6933d2 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -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, @@ -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. diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 349ad4f7fc43b..e8323a218e7a8 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -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), diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs index 31104411ab55b..0944edd86ef19 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs @@ -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, @@ -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, diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index ed951015a4f19..5a4d1794623f1 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -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; @@ -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), @@ -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), @@ -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> { diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs index f1e138dbcb97a..b5e40058e7533 100644 --- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs +++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs @@ -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, diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index be10d5ffad471..c91b67e763811 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -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; @@ -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; @@ -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`" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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, diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs index 7b8e09943df71..459d13e46e854 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs @@ -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, diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs index eaa87f1d4cbc6..af529386eee2a 100644 --- a/compiler/rustc_hir_typeck/src/cast.rs +++ b/compiler/rustc_hir_typeck/src/cast.rs @@ -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, @@ -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, @@ -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, diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index 5c44836adcd01..8251669ea8d2a 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -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; @@ -215,7 +215,7 @@ pub(crate) struct MissingParenthesesInRange<'tcx> { pub add_missing_parentheses: Option, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] pub(crate) enum NeverTypeFallbackFlowingIntoUnsafe { #[help("specify the type explicitly")] #[diag("never type fallback affects this call to an `unsafe` function")] @@ -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> { @@ -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" @@ -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}`" )] @@ -769,7 +769,7 @@ pub(crate) struct SuggestPtrNullMut { pub span: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag( "trivial {$numeric -> [true] numeric cast @@ -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( @@ -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, diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs index c10e7f3bfb8b9..79fdfd3563676 100644 --- a/compiler/rustc_hir_typeck/src/fallback.rs +++ b/compiler/rustc_hir_typeck/src/fallback.rs @@ -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, @@ -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), diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 1931222bba30e..81523cdf633d5 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -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, diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs index 608bc7dffd9c0..6e5b05a8191fc 100644 --- a/compiler/rustc_hir_typeck/src/method/confirm.rs +++ b/compiler/rustc_hir_typeck/src/method/confirm.rs @@ -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, diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 4204855f199d4..28ca6f9fcac20 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -573,6 +573,20 @@ pub fn diag_lint_level<'a, D: Diagnostic<'a, ()> + 'a>( false }; + if disable_suggestions { + // If this is a future incompatible that is not an edition fixing lint + // it'll become a hard error, so we have to emit *something*. Also, + // if this lint occurs in the expansion of a macro from an external crate, + // allow individual lints to opt-out from being reported. + let incompatible = future_incompatible.is_some_and(|f| f.reason.edition().is_none()); + + if !incompatible && !lint.report_in_external_macro { + // Don't continue further, since we don't want to have + // `diag_span_note_once` called for a diagnostic that isn't emitted. + return; + } + } + let mut err: Diag<'_, ()> = if !skip { decorate(sess.dcx(), err_level) } else { @@ -597,20 +611,6 @@ pub fn diag_lint_level<'a, D: Diagnostic<'a, ()> + 'a>( // Any suggestions made here are likely to be incorrect, so anything we // emit shouldn't be automatically fixed by rustfix. err.disable_suggestions(); - - // If this is a future incompatible that is not an edition fixing lint - // it'll become a hard error, so we have to emit *something*. Also, - // if this lint occurs in the expansion of a macro from an external crate, - // allow individual lints to opt-out from being reported. - let incompatible = future_incompatible.is_some_and(|f| f.reason.edition().is_none()); - - if !incompatible && !lint.report_in_external_macro { - err.cancel(); - - // Don't continue further, since we don't want to have - // `diag_span_note_once` called for a diagnostic that isn't emitted. - return; - } } err.is_lint(lint.name_lower(), has_future_breakage); diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index b57de30201876..9eb41e57d4dce 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -29,7 +29,7 @@ use rustc_data_structures::steal::Steal; use rustc_data_structures::sync::{ self, DynSend, DynSync, FreezeReadGuard, Lock, RwLock, WorkerLocal, }; -use rustc_errors::{Applicability, Diag, DiagCtxtHandle, LintDiagnostic, MultiSpan}; +use rustc_errors::{Applicability, Diag, DiagCtxtHandle, Diagnostic, LintDiagnostic, MultiSpan}; use rustc_hir::def::DefKind; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId}; use rustc_hir::definitions::{DefPathData, Definitions, DisambiguatorState}; @@ -55,7 +55,7 @@ use crate::dep_graph::dep_node::make_metadata; use crate::dep_graph::{DepGraph, DepKindVTable, DepNodeIndex}; use crate::ich::StableHashingContext; use crate::infer::canonical::{CanonicalParamEnvCache, CanonicalVarKind}; -use crate::lint::lint_level; +use crate::lint::{diag_lint_level, lint_level}; use crate::metadata::ModChild; use crate::middle::codegen_fn_attrs::{CodegenFnAttrs, TargetFeature}; use crate::middle::resolve_bound_vars; @@ -2511,6 +2511,20 @@ impl<'tcx> TyCtxt<'tcx> { }) } + /// Emit a lint at `span` from a lint struct (some type that implements `Diagnostic`, + /// typically generated by `#[derive(Diagnostic)]`). + #[track_caller] + pub fn emit_diag_node_span_lint( + self, + lint: &'static Lint, + hir_id: HirId, + span: impl Into, + decorator: impl for<'a> Diagnostic<'a, ()>, + ) { + let level = self.lint_level_at_node(lint, hir_id); + diag_lint_level(self.sess, lint, level, Some(span.into()), decorator) + } + /// Emit a lint at the appropriate level for a hir node, with an associated span. /// /// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature diff --git a/tests/ui/coherence/orphan-check-alias.classic.stderr b/tests/ui/coherence/orphan-check-alias.classic.stderr index 25fde6ee1d23d..06b6bd4eb0fd5 100644 --- a/tests/ui/coherence/orphan-check-alias.classic.stderr +++ b/tests/ui/coherence/orphan-check-alias.classic.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait2 for ::Assoc { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`B`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-alias.next.stderr b/tests/ui/coherence/orphan-check-alias.next.stderr index 25fde6ee1d23d..06b6bd4eb0fd5 100644 --- a/tests/ui/coherence/orphan-check-alias.next.stderr +++ b/tests/ui/coherence/orphan-check-alias.next.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait2 for ::Assoc { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`B`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr index 464413e9f38c8..a000fc2f0bc11 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait1 for ::Output {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr index 464413e9f38c8..a000fc2f0bc11 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait1 for ::Output {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr index 0465fad21194f..1d71966b18cb7 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait0 for <() as Trait>::Assoc {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning[E0210]: type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) @@ -16,10 +16,10 @@ warning[E0210]: type parameter `U` must be covered by another type when it appea LL | impl foreign::Trait0 for <() as Trait>::Assoc {} | ^ type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 warning: 2 warnings emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr index 0465fad21194f..1d71966b18cb7 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait0 for <() as Trait>::Assoc {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning[E0210]: type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) @@ -16,10 +16,10 @@ warning[E0210]: type parameter `U` must be covered by another type when it appea LL | impl foreign::Trait0 for <() as Trait>::Assoc {} | ^ type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 warning: 2 warnings emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr index de34ef7cfd3a1..8ea6496a42d70 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait0 for ::Output {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) @@ -16,10 +16,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait0<::Output, Local, T> for Option {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:40:6 @@ -27,10 +27,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait1 for ::Output {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 warning: 3 warnings emitted diff --git a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr index de34ef7cfd3a1..8ea6496a42d70 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait0 for ::Output {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) @@ -16,10 +16,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait0<::Output, Local, T> for Option {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:40:6 @@ -27,10 +27,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait1 for ::Output {} | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 warning: 3 warnings emitted diff --git a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr index e729bcf225eb1..1289c65b40d06 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait1 for as Discard>::Output | ^ type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr index e729bcf225eb1..1289c65b40d06 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr @@ -4,10 +4,10 @@ warning[E0210]: type parameter `T` must be covered by another type when it appea LL | impl foreign::Trait1 for as Discard>::Output | ^ type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #124559 = 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 = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr index a910b19d9bf76..17dc5fc8795bc 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr +++ b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr @@ -4,14 +4,14 @@ error: this function depends on never type fallback being `()` LL | fn m() { | ^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:24:17 | LL | true => Default::default(), | ^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -24,14 +24,14 @@ error: this function depends on never type fallback being `()` LL | fn q() -> Option<()> { | ^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:39:5 | LL | deserialize()?; | ^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see help: use `()` annotations to avoid fallback changes | LL | deserialize::<()>()?; @@ -43,14 +43,14 @@ error: this function depends on never type fallback being `()` LL | fn meow() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `(): From` will fail --> $DIR/never-type-fallback-breaking.rs:52:5 | LL | help(1)?; | ^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see help: use `()` annotations to avoid fallback changes | LL | help::<(), _>(1)?; @@ -62,14 +62,14 @@ error: this function depends on never type fallback being `()` LL | pub fn fallback_return() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:64:19 | LL | takes_apit(|| Default::default())?; | ^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see help: use `()` annotations to avoid fallback changes | LL | takes_apit::<()>(|| Default::default())?; @@ -81,14 +81,14 @@ error: this function depends on never type fallback being `()` LL | fn fully_apit() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:78:17 | LL | takes_apit2(mk()?); | ^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see help: use `()` annotations to avoid fallback changes | LL | takes_apit2(mk::<()>()?); @@ -103,14 +103,14 @@ error: this function depends on never type fallback being `()` LL | fn m() { | ^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:24:17 | LL | true => Default::default(), | ^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -124,14 +124,14 @@ error: this function depends on never type fallback being `()` LL | fn q() -> Option<()> { | ^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:39:5 | LL | deserialize()?; | ^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -145,14 +145,14 @@ error: this function depends on never type fallback being `()` LL | fn meow() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `(): From` will fail --> $DIR/never-type-fallback-breaking.rs:52:5 | LL | help(1)?; | ^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -166,14 +166,14 @@ error: this function depends on never type fallback being `()` LL | pub fn fallback_return() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:64:19 | LL | takes_apit(|| Default::default())?; | ^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -187,14 +187,14 @@ error: this function depends on never type fallback being `()` LL | fn fully_apit() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:78:17 | LL | takes_apit2(mk()?); | ^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | diff --git a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr index 0b8d9657c7b0a..bb9de45637a09 100644 --- a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr +++ b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr @@ -4,14 +4,14 @@ error: this function depends on never type fallback being `()` LL | fn def() { | ^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dependency-on-fallback-to-unit.rs:10:19 | LL | false => <_>::default(), | ^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -25,14 +25,14 @@ error: this function depends on never type fallback being `()` LL | fn question_mark() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dependency-on-fallback-to-unit.rs:20:5 | LL | deserialize()?; | ^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see help: use `()` annotations to avoid fallback changes | LL | deserialize::<()>()?; @@ -47,14 +47,14 @@ error: this function depends on never type fallback being `()` LL | fn def() { | ^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dependency-on-fallback-to-unit.rs:10:19 | LL | false => <_>::default(), | ^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -69,14 +69,14 @@ error: this function depends on never type fallback being `()` LL | fn question_mark() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dependency-on-fallback-to-unit.rs:20:5 | LL | deserialize()?; | ^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | diff --git a/tests/ui/never_type/diverging-fallback-unconstrained-return.e2021.stderr b/tests/ui/never_type/diverging-fallback-unconstrained-return.e2021.stderr index eb79cf5dd1559..40e7e30274be8 100644 --- a/tests/ui/never_type/diverging-fallback-unconstrained-return.e2021.stderr +++ b/tests/ui/never_type/diverging-fallback-unconstrained-return.e2021.stderr @@ -4,14 +4,14 @@ error: this function depends on never type fallback being `()` LL | fn main() { | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: UnitReturn` will fail --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 | LL | let _ = if true { unconstrained_return() } else { panic!() }; | ^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -27,14 +27,14 @@ error: this function depends on never type fallback being `()` LL | fn main() { | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: UnitReturn` will fail --> $DIR/diverging-fallback-unconstrained-return.rs:37:23 | LL | let _ = if true { unconstrained_return() } else { panic!() }; | ^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | diff --git a/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr b/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr index 9795acffe7058..73c2a5bd3907e 100644 --- a/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr +++ b/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr @@ -4,14 +4,14 @@ error: this function depends on never type fallback being `()` LL | fn main() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dont-suggest-turbofish-from-expansion.rs:12:23 | LL | let created = create_ok_default()?; | ^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -27,14 +27,14 @@ error: this function depends on never type fallback being `()` LL | fn main() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dont-suggest-turbofish-from-expansion.rs:12:23 | LL | let created = create_ok_default()?; | ^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | diff --git a/tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr b/tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr index 96749de1195eb..a0a300aae6af7 100644 --- a/tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr +++ b/tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr @@ -4,14 +4,14 @@ error: this function depends on never type fallback being `()` LL | fn test() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/lint-breaking-2024-assign-underscore.rs:11:9 | LL | _ = foo()?; | ^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -27,14 +27,14 @@ error: this function depends on never type fallback being `()` LL | fn test() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/lint-breaking-2024-assign-underscore.rs:11:9 | LL | _ = foo()?; | ^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see = note: `#[deny(dependency_on_unit_never_type_fallback)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | diff --git a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr index 84e143b024acc..730e449704859 100644 --- a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr +++ b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr @@ -4,9 +4,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { mem::zeroed() } | ^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -19,9 +19,9 @@ error: never type fallback affects this call to an `unsafe` function LL | core::mem::transmute(Zst) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | core::mem::transmute::<_, ()>(Zst) @@ -33,9 +33,9 @@ error: never type fallback affects this union access LL | unsafe { Union { a: () }.b } | ^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly error: never type fallback affects this raw pointer dereference --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:55:18 @@ -43,9 +43,9 @@ error: never type fallback affects this raw pointer dereference LL | unsafe { *ptr::from_ref(&()).cast() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | unsafe { *ptr::from_ref(&()).cast::<()>() } @@ -57,9 +57,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { internally_create(x) } | ^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | unsafe { internally_create::<()>(x) } @@ -71,9 +71,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { zeroed() } | ^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | let zeroed = mem::zeroed::<()>; @@ -85,9 +85,9 @@ error: never type fallback affects this `unsafe` function LL | let zeroed = mem::zeroed; | ^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | let zeroed = mem::zeroed::<()>; @@ -99,9 +99,9 @@ error: never type fallback affects this `unsafe` function LL | let f = internally_create; | ^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | let f = internally_create::<()>; @@ -113,9 +113,9 @@ error: never type fallback affects this call to an `unsafe` method LL | S(marker::PhantomData).create_out_of_thin_air() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly error: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:155:19 @@ -126,9 +126,9 @@ LL | match send_message::<_ /* ?0 */>() { LL | msg_send!(); | ----------- in this macro invocation | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 10 previous errors @@ -140,9 +140,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { mem::zeroed() } | ^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -156,9 +156,9 @@ error: never type fallback affects this call to an `unsafe` function LL | core::mem::transmute(Zst) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -172,9 +172,9 @@ error: never type fallback affects this union access LL | unsafe { Union { a: () }.b } | ^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default Future breakage diagnostic: @@ -184,9 +184,9 @@ error: never type fallback affects this raw pointer dereference LL | unsafe { *ptr::from_ref(&()).cast() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -200,9 +200,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { internally_create(x) } | ^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -216,9 +216,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { zeroed() } | ^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -232,9 +232,9 @@ error: never type fallback affects this `unsafe` function LL | let zeroed = mem::zeroed; | ^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -248,9 +248,9 @@ error: never type fallback affects this `unsafe` function LL | let f = internally_create; | ^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -264,9 +264,9 @@ error: never type fallback affects this call to an `unsafe` method LL | S(marker::PhantomData).create_out_of_thin_air() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default Future breakage diagnostic: @@ -279,9 +279,9 @@ LL | match send_message::<_ /* ?0 */>() { LL | msg_send!(); | ----------- in this macro invocation | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr index 09e4d02384e92..631b6dae92942 100644 --- a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr +++ b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr @@ -4,9 +4,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { mem::zeroed() } | ^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -19,9 +19,9 @@ error: never type fallback affects this call to an `unsafe` function LL | core::mem::transmute(Zst) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | core::mem::transmute::<_, ()>(Zst) @@ -33,9 +33,9 @@ error: never type fallback affects this union access LL | unsafe { Union { a: () }.b } | ^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly error: never type fallback affects this raw pointer dereference --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:55:18 @@ -43,9 +43,9 @@ error: never type fallback affects this raw pointer dereference LL | unsafe { *ptr::from_ref(&()).cast() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | unsafe { *ptr::from_ref(&()).cast::<()>() } @@ -57,9 +57,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { internally_create(x) } | ^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | unsafe { internally_create::<()>(x) } @@ -71,9 +71,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { zeroed() } | ^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | let zeroed = mem::zeroed::<()>; @@ -85,9 +85,9 @@ error: never type fallback affects this `unsafe` function LL | let zeroed = mem::zeroed; | ^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | let zeroed = mem::zeroed::<()>; @@ -99,9 +99,9 @@ error: never type fallback affects this `unsafe` function LL | let f = internally_create; | ^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | LL | let f = internally_create::<()>; @@ -113,9 +113,9 @@ error: never type fallback affects this call to an `unsafe` method LL | S(marker::PhantomData).create_out_of_thin_air() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly error: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:155:19 @@ -126,9 +126,9 @@ LL | match send_message::<_ /* ?0 */>() { LL | msg_send!(); | ----------- in this macro invocation | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) warning: the type `!` does not permit zero-initialization @@ -149,9 +149,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { mem::zeroed() } | ^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -165,9 +165,9 @@ error: never type fallback affects this call to an `unsafe` function LL | core::mem::transmute(Zst) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -181,9 +181,9 @@ error: never type fallback affects this union access LL | unsafe { Union { a: () }.b } | ^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default Future breakage diagnostic: @@ -193,9 +193,9 @@ error: never type fallback affects this raw pointer dereference LL | unsafe { *ptr::from_ref(&()).cast() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -209,9 +209,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { internally_create(x) } | ^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -225,9 +225,9 @@ error: never type fallback affects this call to an `unsafe` function LL | unsafe { zeroed() } | ^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -241,9 +241,9 @@ error: never type fallback affects this `unsafe` function LL | let zeroed = mem::zeroed; | ^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -257,9 +257,9 @@ error: never type fallback affects this `unsafe` function LL | let f = internally_create; | ^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default help: use `()` annotations to avoid fallback changes | @@ -273,9 +273,9 @@ error: never type fallback affects this call to an `unsafe` method LL | S(marker::PhantomData).create_out_of_thin_air() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default Future breakage diagnostic: @@ -288,9 +288,9 @@ LL | match send_message::<_ /* ?0 */>() { LL | msg_send!(); | ----------- in this macro invocation | + = help: specify the type explicitly = warning: this changes meaning in Rust 2024 and in a future release in all editions! = note: for more information, see - = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` (part of `#[deny(rust_2024_compatibility)]`) on by default = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info)