From e1ee66935e0f1b7606e5d1dfa850cf730fd85000 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 5 Mar 2026 16:22:25 +0100 Subject: [PATCH] Remove `TyCtxt::node_span_lint` usage from `rustc_hir_analysis` --- .../rustc_hir_analysis/src/check/check.rs | 99 ++++++++++++------- compiler/rustc_hir_analysis/src/check/mod.rs | 2 +- .../rustc_hir_analysis/src/check_unused.rs | 31 ++++-- compiler/rustc_hir_analysis/src/collect.rs | 25 +++-- .../src/collect/generics_of.rs | 18 +++- .../src/hir_ty_lowering/dyn_trait.rs | 46 ++++++--- .../src/hir_ty_lowering/generics.rs | 22 ++++- .../src/hir_ty_lowering/mod.rs | 91 ++++++++++++----- tests/ui/abi/unsupported.aarch64.stderr | 8 +- tests/ui/abi/unsupported.arm.stderr | 8 +- tests/ui/abi/unsupported.riscv32.stderr | 8 +- tests/ui/abi/unsupported.riscv64.stderr | 8 +- tests/ui/abi/unsupported.x64.stderr | 8 +- tests/ui/abi/unsupported.x64_win.stderr | 18 ++-- .../repr-c-big-discriminant1.ptr64.stderr | 20 ++-- .../repr-c-big-discriminant2.ptr64.stderr | 4 +- .../raw-dylib/windows/unsupported-abi.stderr | 2 +- .../future-incompatible-lint-group.stderr | 4 +- .../lint/improper-ctypes/lint-ctypes.stderr | 2 +- tests/ui/lint/improper-ctypes/lint-fn.stderr | 2 +- .../repr-transparent-non-exhaustive.stderr | 68 ++++++------- tests/ui/repr/repr-transparent-repr-c.stderr | 12 +-- tests/ui/statics/uninhabited-static.stderr | 8 +- ...ity-lint-ambiguous_associated_items.stderr | 4 +- 24 files changed, 329 insertions(+), 189 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 94988f3c9275..f3d234afef05 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -4,7 +4,7 @@ use rustc_abi::{ExternAbi, FieldIdx, ScalableElt}; use rustc_data_structures::unord::{UnordMap, UnordSet}; use rustc_errors::codes::*; -use rustc_errors::{EmissionGuarantee, MultiSpan}; +use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, MultiSpan}; use rustc_hir as hir; use rustc_hir::attrs::ReprAttr::ReprPacked; use rustc_hir::def::{CtorKind, DefKind}; @@ -12,6 +12,7 @@ use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt}; use rustc_infer::traits::{Obligation, ObligationCauseCode, WellFormedLoc}; use rustc_lint_defs::builtin::{REPR_TRANSPARENT_NON_ZST_FIELDS, UNSUPPORTED_CALLING_CONVENTIONS}; +use rustc_macros::Diagnostic; use rustc_middle::hir::nested_filter; use rustc_middle::middle::resolve_bound_vars::ResolvedArg; use rustc_middle::middle::stability::EvalResult; @@ -53,6 +54,22 @@ fn add_abi_diag_help(abi: ExternAbi, diag: &mut Diag<'_, T } pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi) { + struct UnsupportedCallingConventions { + abi: ExternAbi, + } + + impl<'a> Diagnostic<'a, ()> for UnsupportedCallingConventions { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { abi } = self; + let mut lint = Diag::new( + dcx, + level, + format!("{abi} is not a supported ABI for the current target"), + ); + add_abi_diag_help(abi, &mut lint); + lint + } + } // FIXME: This should be checked earlier, e.g. in `rustc_ast_lowering`, as this // currently only guards function imports, function definitions, and function pointer types. // Functions in trait declarations can still use "deprecated" ABIs without any warning. @@ -64,12 +81,12 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi tcx.dcx().span_delayed_bug(span, format!("{abi} should be rejected in ast_lowering")); } AbiMapping::Deprecated(..) => { - tcx.node_span_lint(UNSUPPORTED_CALLING_CONVENTIONS, hir_id, span, |lint| { - lint.primary_message(format!( - "{abi} is not a supported ABI for the current target" - )); - add_abi_diag_help(abi, lint); - }); + tcx.emit_node_span_lint( + UNSUPPORTED_CALLING_CONVENTIONS, + hir_id, + span, + UnsupportedCallingConventions { abi }, + ); } } } @@ -174,6 +191,11 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b /// Check that a `static` is inhabited. fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) { + #[derive(Diagnostic)] + #[diag("static of uninhabited type")] + #[note("uninhabited statics cannot be initialized, and any access would be an immediate error")] + struct StaticOfUninhabitedType; + // Make sure statics are inhabited. // Other parts of the compiler assume that there are no uninhabited places. In principle it // would be enough to check this for `extern` statics, as statics with an initializer will @@ -204,15 +226,11 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) { } }; if layout.is_uninhabited() { - tcx.node_span_lint( + tcx.emit_node_span_lint( UNINHABITED_STATIC, tcx.local_def_id_to_hir_id(def_id), span, - |lint| { - lint.primary_message("static of uninhabited type"); - lint - .note("uninhabited statics cannot be initialized, and any access would be an immediate error"); - }, + StaticOfUninhabitedType, ); } } @@ -1637,6 +1655,39 @@ pub(super) fn check_packed_inner( } pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>) { + struct ZeroSizedFieldReprTransparentIncompatibility<'tcx> { + unsuited: UnsuitedInfo<'tcx>, + } + + impl<'a, 'tcx> Diagnostic<'a, ()> for ZeroSizedFieldReprTransparentIncompatibility<'tcx> { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { unsuited } = self; + let (title, note) = match unsuited.reason { + UnsuitedReason::NonExhaustive => ( + "external non-exhaustive types", + "is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future.", + ), + UnsuitedReason::PrivateField => ( + "external types with private fields", + "contains private fields, so it could become non-zero-sized in the future.", + ), + UnsuitedReason::ReprC => ( + "`repr(C)` types", + "is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets.", + ), + }; + Diag::new( + dcx, + level, + format!("zero-sized fields in `repr(transparent)` cannot contain {title}"), + ) + .with_note(format!( + "this field contains `{field_ty}`, which {note}", + field_ty = unsuited.ty, + )) + } + } + if !adt.repr().transparent() { return; } @@ -1747,29 +1798,11 @@ fn check_unsuited<'tcx>( // If there are any non-trivial fields, then there can be no non-exhaustive 1-zsts. // Otherwise, it's only an issue if there's >1 non-exhaustive 1-zst. if non_trivial_count > 0 || prev_unsuited_1zst { - tcx.node_span_lint( + tcx.emit_node_span_lint( REPR_TRANSPARENT_NON_ZST_FIELDS, tcx.local_def_id_to_hir_id(adt.did().expect_local()), field.span, - |lint| { - let title = match unsuited.reason { - UnsuitedReason::NonExhaustive => "external non-exhaustive types", - UnsuitedReason::PrivateField => "external types with private fields", - UnsuitedReason::ReprC => "`repr(C)` types", - }; - lint.primary_message( - format!("zero-sized fields in `repr(transparent)` cannot contain {title}"), - ); - let note = match unsuited.reason { - UnsuitedReason::NonExhaustive => "is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future.", - UnsuitedReason::PrivateField => "contains private fields, so it could become non-zero-sized in the future.", - UnsuitedReason::ReprC => "is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets.", - }; - lint.note(format!( - "this field contains `{field_ty}`, which {note}", - field_ty = unsuited.ty, - )); - }, + ZeroSizedFieldReprTransparentIncompatibility { unsuited }, ); } else { prev_unsuited_1zst = true; diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index 61e613330606..458bb6ddd211 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -77,7 +77,7 @@ pub use check::{check_abi, check_custom_abi}; use rustc_abi::VariantIdx; use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; -use rustc_errors::{Diag, ErrorGuaranteed, pluralize, struct_span_code_err}; +use rustc_errors::{ErrorGuaranteed, pluralize, struct_span_code_err}; use rustc_hir::LangItem; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::Visitor; diff --git a/compiler/rustc_hir_analysis/src/check_unused.rs b/compiler/rustc_hir_analysis/src/check_unused.rs index 3fb33c741c9d..7302913cc1ae 100644 --- a/compiler/rustc_hir_analysis/src/check_unused.rs +++ b/compiler/rustc_hir_analysis/src/check_unused.rs @@ -1,10 +1,28 @@ use rustc_data_structures::unord::{ExtendUnord, UnordSet}; +use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level}; use rustc_hir::def::DefKind; use rustc_hir::def_id::LocalDefId; use rustc_middle::ty::TyCtxt; use rustc_session::lint; +use rustc_span::Span; use tracing::debug; +struct UnusedImport<'tcx> { + tcx: TyCtxt<'tcx>, + span: Span, +} + +impl<'a, 'tcx> Diagnostic<'a, ()> for UnusedImport<'tcx> { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { tcx, span } = self; + if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(span) { + Diag::new(dcx, level, format!("unused import: `{snippet}`")) + } else { + Diag::new(dcx, level, "unused import") + } + } +} + pub(super) fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) { let mut used_trait_imports = UnordSet::::default(); @@ -31,12 +49,11 @@ pub(super) fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) { continue; } let (path, _) = item.expect_use(); - tcx.node_span_lint(lint::builtin::UNUSED_IMPORTS, item.hir_id(), path.span, |lint| { - if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(path.span) { - lint.primary_message(format!("unused import: `{snippet}`")); - } else { - lint.primary_message("unused import"); - } - }); + tcx.emit_node_span_lint( + lint::builtin::UNUSED_IMPORTS, + item.hir_id(), + path.span, + UnusedImport { tcx, span: path.span }, + ); } } diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index f4c7234cd8f8..6850e67aff1a 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -22,7 +22,9 @@ use rustc_ast::Recovered; use rustc_data_structures::assert_matches; use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; -use rustc_errors::{Applicability, Diag, DiagCtxtHandle, E0228, ErrorGuaranteed, StashKey}; +use rustc_errors::{ + Applicability, Diag, DiagCtxtHandle, Diagnostic, E0228, ErrorGuaranteed, Level, StashKey, +}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::{self, InferKind, Visitor, VisitorExt}; @@ -610,6 +612,19 @@ pub(super) fn lower_variant_ctor(tcx: TyCtxt<'_>, def_id: LocalDefId) { } pub(super) fn lower_enum_variant_types(tcx: TyCtxt<'_>, def_id: LocalDefId) { + struct ReprCIssue { + msg: &'static str, + } + + impl<'a> Diagnostic<'a, ()> for ReprCIssue { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { msg } = self; + Diag::new(dcx, level, msg) + .with_note("`repr(C)` enums with big discriminants are non-portable, and their size in Rust might not match their size in C") + .with_help("use `repr($int_ty)` instead to explicitly set the size of this enum") + } + } + let def = tcx.adt_def(def_id); let repr_type = def.repr().discr_type(); let initial = repr_type.initial_discriminant(tcx); @@ -659,15 +674,11 @@ pub(super) fn lower_enum_variant_types(tcx: TyCtxt<'_>, def_id: LocalDefId) { } else { "`repr(C)` enum discriminant does not fit into C `int`, and a previous discriminant does not fit into C `unsigned int`" }; - tcx.node_span_lint( + tcx.emit_node_span_lint( rustc_session::lint::builtin::REPR_C_ENUMS_LARGER_THAN_INT, tcx.local_def_id_to_hir_id(def_id), span, - |d| { - d.primary_message(msg) - .note("`repr(C)` enums with big discriminants are non-portable, and their size in Rust might not match their size in C") - .help("use `repr($int_ty)` instead to explicitly set the size of this enum"); - } + ReprCIssue { msg }, ); } } diff --git a/compiler/rustc_hir_analysis/src/collect/generics_of.rs b/compiler/rustc_hir_analysis/src/collect/generics_of.rs index b4c264c3a236..e1ec57aea921 100644 --- a/compiler/rustc_hir_analysis/src/collect/generics_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/generics_of.rs @@ -1,6 +1,7 @@ use std::ops::ControlFlow; use rustc_data_structures::assert_matches; +use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level}; use rustc_hir::def::DefKind; use rustc_hir::def_id::LocalDefId; use rustc_hir::intravisit::{self, Visitor, VisitorExt}; @@ -17,6 +18,17 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { use rustc_hir::*; + struct GenericParametersForbiddenHere { + msg: &'static str, + } + + impl<'a> Diagnostic<'a, ()> for GenericParametersForbiddenHere { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { msg } = self; + Diag::new(dcx, level, msg) + } + } + // For an RPITIT, synthesize generics which are equal to the opaque's generics // and parent fn's generics compressed into one list. if let Some(ty::ImplTraitInTraitData::Trait { fn_def_id, opaque_def_id }) = @@ -269,13 +281,11 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { match param_default_policy.expect("no policy for generic param default") { ParamDefaultPolicy::Allowed => {} ParamDefaultPolicy::FutureCompatForbidden => { - tcx.node_span_lint( + tcx.emit_node_span_lint( lint::builtin::INVALID_TYPE_PARAM_DEFAULT, param.hir_id, param.span, - |lint| { - lint.primary_message(MESSAGE); - }, + GenericParametersForbiddenHere { msg: MESSAGE }, ); } ParamDefaultPolicy::Forbidden => { 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 7b8e09943df7..8397ff61a3b3 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 @@ -2,11 +2,12 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_errors::codes::*; use rustc_errors::{ - Applicability, Diag, EmissionGuarantee, StashKey, Suggestions, struct_span_code_err, + Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, StashKey, + Suggestions, struct_span_code_err, }; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::DefId; -use rustc_hir::{self as hir, LangItem}; +use rustc_hir::{self as hir, HirId, LangItem}; use rustc_lint_defs::builtin::{BARE_TRAIT_OBJECTS, UNUSED_ASSOCIATED_TYPE_BOUNDS}; use rustc_middle::ty::elaborate::ClauseWithSupertraitSpan; use rustc_middle::ty::{ @@ -523,6 +524,30 @@ fn prohibit_or_lint_bare_trait_object_ty( hir_id: hir::HirId, hir_bounds: &[hir::PolyTraitRef<'tcx>], ) -> Option { + struct TraitObjectWithoutDyn<'a, 'tcx> { + span: Span, + hir_id: HirId, + sugg: Vec<(Span, String)>, + this: &'a dyn HirTyLowerer<'tcx>, + } + + impl<'a, 'b, 'tcx> Diagnostic<'a, ()> for TraitObjectWithoutDyn<'b, 'tcx> { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { span, hir_id, sugg, this } = self; + let mut lint = + Diag::new(dcx, level, "trait objects without an explicit `dyn` are deprecated"); + if span.can_be_used_for_suggestions() { + lint.multipart_suggestion( + "if this is a dyn-compatible trait, use `dyn`", + sugg, + Applicability::MachineApplicable, + ); + } + this.maybe_suggest_blanket_trait_impl(span, hir_id, &mut lint); + lint + } + } + let tcx = self.tcx(); let [poly_trait_ref, ..] = hir_bounds else { return None }; @@ -606,17 +631,12 @@ fn prohibit_or_lint_bare_trait_object_ty( } Some(diag.emit()) } else { - tcx.node_span_lint(BARE_TRAIT_OBJECTS, hir_id, span, |lint| { - lint.primary_message("trait objects without an explicit `dyn` are deprecated"); - if span.can_be_used_for_suggestions() { - lint.multipart_suggestion( - "if this is a dyn-compatible trait, use `dyn`", - sugg, - Applicability::MachineApplicable, - ); - } - self.maybe_suggest_blanket_trait_impl(span, hir_id, lint); - }); + tcx.emit_node_span_lint( + BARE_TRAIT_OBJECTS, + hir_id, + span, + TraitObjectWithoutDyn { span, hir_id, sugg, this: self }, + ); None } } diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs index ff0a5a8df0fa..0ca57cb50cf2 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs @@ -1,6 +1,9 @@ use rustc_ast::ast::ParamKindOrd; use rustc_errors::codes::*; -use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, struct_span_code_err}; +use rustc_errors::{ + Applicability, Diag, DiagCtxtHandle, Diagnostic, ErrorGuaranteed, Level, MultiSpan, + struct_span_code_err, +}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::{self as hir, GenericArg}; @@ -625,6 +628,17 @@ pub(crate) fn prohibit_explicit_late_bound_lifetimes( args: &hir::GenericArgs<'_>, position: GenericArgPosition, ) -> ExplicitLateBound { + struct LifetimeArgsIssue { + msg: &'static str, + } + + impl<'a> Diagnostic<'a, ()> for LifetimeArgsIssue { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { msg } = self; + Diag::new(dcx, level, msg) + } + } + let param_counts = def.own_counts(); if let Some(span_late) = def.has_late_bound_regions @@ -644,13 +658,11 @@ pub(crate) fn prohibit_explicit_late_bound_lifetimes( } else { let mut multispan = MultiSpan::from_span(span); multispan.push_span_label(span_late, note); - cx.tcx().node_span_lint( + cx.tcx().emit_node_span_lint( LATE_BOUND_LIFETIME_ARGUMENTS, args.args[0].hir_id(), multispan, - |lint| { - lint.primary_message(msg); - }, + LifetimeArgsIssue { msg }, ); } diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 25911d3e9e46..3a41ef47ac52 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -27,7 +27,8 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_errors::codes::*; use rustc_errors::{ - Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, struct_span_code_err, + Applicability, Diag, DiagCtxtHandle, Diagnostic, ErrorGuaranteed, FatalError, Level, + struct_span_code_err, }; use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -1481,6 +1482,54 @@ fn lower_type_relative_path( span: Span, mode: LowerTypeRelativePathMode, ) -> Result, ErrorGuaranteed> { + struct AmbiguousAssocItem<'tcx> { + variant_def_id: DefId, + item_def_id: DefId, + span: Span, + segment_ident: Ident, + bound_def_id: DefId, + self_ty: Ty<'tcx>, + tcx: TyCtxt<'tcx>, + mode: LowerTypeRelativePathMode, + } + + impl<'a, 'tcx> Diagnostic<'a, ()> for AmbiguousAssocItem<'tcx> { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { + variant_def_id, + item_def_id, + span, + segment_ident, + bound_def_id, + self_ty, + tcx, + mode, + } = self; + let mut lint = Diag::new(dcx, level, "ambiguous associated item"); + + let mut could_refer_to = |kind: DefKind, def_id, also| { + let note_msg = format!( + "`{}` could{} refer to the {} defined here", + segment_ident, + also, + tcx.def_kind_descr(kind, def_id) + ); + lint.span_note(tcx.def_span(def_id), note_msg); + }; + + could_refer_to(DefKind::Variant, variant_def_id, ""); + could_refer_to(mode.def_kind_for_diagnostics(), item_def_id, " also"); + + lint.span_suggestion( + span, + "use fully-qualified syntax", + format!("<{} as {}>::{}", self_ty, tcx.item_name(bound_def_id), segment_ident), + Applicability::MachineApplicable, + ); + lint + } + } + debug!(%self_ty, ?segment.ident); let tcx = self.tcx(); @@ -1556,33 +1605,21 @@ fn lower_type_relative_path( let (item_def_id, args) = self.lower_assoc_item_path(span, item_def_id, segment, bound)?; if let Some(variant_def_id) = variant_def_id { - tcx.node_span_lint(AMBIGUOUS_ASSOCIATED_ITEMS, qpath_hir_id, span, |lint| { - lint.primary_message("ambiguous associated item"); - let mut could_refer_to = |kind: DefKind, def_id, also| { - let note_msg = format!( - "`{}` could{} refer to the {} defined here", - segment.ident, - also, - tcx.def_kind_descr(kind, def_id) - ); - lint.span_note(tcx.def_span(def_id), note_msg); - }; - - could_refer_to(DefKind::Variant, variant_def_id, ""); - could_refer_to(mode.def_kind_for_diagnostics(), item_def_id, " also"); - - lint.span_suggestion( + tcx.emit_node_span_lint( + AMBIGUOUS_ASSOCIATED_ITEMS, + qpath_hir_id, + span, + AmbiguousAssocItem { + variant_def_id, + item_def_id, span, - "use fully-qualified syntax", - format!( - "<{} as {}>::{}", - self_ty, - tcx.item_name(bound.def_id()), - segment.ident - ), - Applicability::MachineApplicable, - ); - }); + segment_ident: segment.ident, + bound_def_id: bound.def_id(), + self_ty, + tcx, + mode, + }, + ); } Ok(TypeRelativePath::AssocItem(item_def_id, args)) diff --git a/tests/ui/abi/unsupported.aarch64.stderr b/tests/ui/abi/unsupported.aarch64.stderr index 00cc31170b74..6add008aa60f 100644 --- a/tests/ui/abi/unsupported.aarch64.stderr +++ b/tests/ui/abi/unsupported.aarch64.stderr @@ -162,9 +162,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | fn cdecl_ptr(f: extern "cdecl" fn()) { | ^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target @@ -173,9 +173,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" {} | ^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead warning: "cdecl-unwind" is not a supported ABI for the current target --> $DIR/unsupported.rs:108:1 @@ -183,9 +183,9 @@ warning: "cdecl-unwind" is not a supported ABI for the current target LL | extern "cdecl-unwind" {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C-unwind"` instead = 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 #137018 - = help: use `extern "C-unwind"` instead warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:97:1 @@ -193,9 +193,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" fn cdecl() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead error: aborting due to 25 previous errors; 4 warnings emitted diff --git a/tests/ui/abi/unsupported.arm.stderr b/tests/ui/abi/unsupported.arm.stderr index 23bdcc227295..ab345f9e42e9 100644 --- a/tests/ui/abi/unsupported.arm.stderr +++ b/tests/ui/abi/unsupported.arm.stderr @@ -144,9 +144,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | fn cdecl_ptr(f: extern "cdecl" fn()) { | ^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target @@ -155,9 +155,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" {} | ^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead warning: "cdecl-unwind" is not a supported ABI for the current target --> $DIR/unsupported.rs:108:1 @@ -165,9 +165,9 @@ warning: "cdecl-unwind" is not a supported ABI for the current target LL | extern "cdecl-unwind" {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C-unwind"` instead = 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 #137018 - = help: use `extern "C-unwind"` instead warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:97:1 @@ -175,9 +175,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" fn cdecl() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead error: aborting due to 22 previous errors; 4 warnings emitted diff --git a/tests/ui/abi/unsupported.riscv32.stderr b/tests/ui/abi/unsupported.riscv32.stderr index ef1f1b53cdc5..e2ca35d6a50e 100644 --- a/tests/ui/abi/unsupported.riscv32.stderr +++ b/tests/ui/abi/unsupported.riscv32.stderr @@ -156,9 +156,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | fn cdecl_ptr(f: extern "cdecl" fn()) { | ^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target @@ -167,9 +167,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" {} | ^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead warning: "cdecl-unwind" is not a supported ABI for the current target --> $DIR/unsupported.rs:108:1 @@ -177,9 +177,9 @@ warning: "cdecl-unwind" is not a supported ABI for the current target LL | extern "cdecl-unwind" {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C-unwind"` instead = 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 #137018 - = help: use `extern "C-unwind"` instead warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:97:1 @@ -187,9 +187,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" fn cdecl() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead error: aborting due to 24 previous errors; 4 warnings emitted diff --git a/tests/ui/abi/unsupported.riscv64.stderr b/tests/ui/abi/unsupported.riscv64.stderr index ef1f1b53cdc5..e2ca35d6a50e 100644 --- a/tests/ui/abi/unsupported.riscv64.stderr +++ b/tests/ui/abi/unsupported.riscv64.stderr @@ -156,9 +156,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | fn cdecl_ptr(f: extern "cdecl" fn()) { | ^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target @@ -167,9 +167,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" {} | ^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead warning: "cdecl-unwind" is not a supported ABI for the current target --> $DIR/unsupported.rs:108:1 @@ -177,9 +177,9 @@ warning: "cdecl-unwind" is not a supported ABI for the current target LL | extern "cdecl-unwind" {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C-unwind"` instead = 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 #137018 - = help: use `extern "C-unwind"` instead warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:97:1 @@ -187,9 +187,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" fn cdecl() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead error: aborting due to 24 previous errors; 4 warnings emitted diff --git a/tests/ui/abi/unsupported.x64.stderr b/tests/ui/abi/unsupported.x64.stderr index 0c338849ae9d..41842eecbd02 100644 --- a/tests/ui/abi/unsupported.x64.stderr +++ b/tests/ui/abi/unsupported.x64.stderr @@ -138,9 +138,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | fn cdecl_ptr(f: extern "cdecl" fn()) { | ^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "cdecl" is not a supported ABI for the current target @@ -149,9 +149,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" {} | ^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead warning: "cdecl-unwind" is not a supported ABI for the current target --> $DIR/unsupported.rs:108:1 @@ -159,9 +159,9 @@ warning: "cdecl-unwind" is not a supported ABI for the current target LL | extern "cdecl-unwind" {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C-unwind"` instead = 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 #137018 - = help: use `extern "C-unwind"` instead warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:97:1 @@ -169,9 +169,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" fn cdecl() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead error: aborting due to 21 previous errors; 4 warnings emitted diff --git a/tests/ui/abi/unsupported.x64_win.stderr b/tests/ui/abi/unsupported.x64_win.stderr index 07c4eb691fe9..79938f04c599 100644 --- a/tests/ui/abi/unsupported.x64_win.stderr +++ b/tests/ui/abi/unsupported.x64_win.stderr @@ -106,9 +106,9 @@ warning: "stdcall" is not a supported ABI for the current target LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ | + = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` = 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 #137018 - = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default warning: "stdcall" is not a supported ABI for the current target @@ -117,9 +117,9 @@ warning: "stdcall" is not a supported ABI for the current target LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ | + = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` = 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 #137018 - = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` warning: "stdcall-unwind" is not a supported ABI for the current target --> $DIR/unsupported.rs:92:1 @@ -127,9 +127,9 @@ warning: "stdcall-unwind" is not a supported ABI for the current target LL | extern "stdcall-unwind" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: if you need `extern "stdcall-unwind"` on win32 and `extern "C-unwind"` everywhere else, use `extern "system-unwind"` = 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 #137018 - = help: if you need `extern "stdcall-unwind"` on win32 and `extern "C-unwind"` everywhere else, use `extern "system-unwind"` warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:100:17 @@ -137,9 +137,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | fn cdecl_ptr(f: extern "cdecl" fn()) { | ^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:105:1 @@ -147,9 +147,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" {} | ^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead warning: "cdecl-unwind" is not a supported ABI for the current target --> $DIR/unsupported.rs:108:1 @@ -157,9 +157,9 @@ warning: "cdecl-unwind" is not a supported ABI for the current target LL | extern "cdecl-unwind" {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C-unwind"` instead = 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 #137018 - = help: use `extern "C-unwind"` instead warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:137:1 @@ -167,9 +167,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" {} | ^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead warning: "stdcall" is not a supported ABI for the current target --> $DIR/unsupported.rs:78:1 @@ -177,9 +177,9 @@ warning: "stdcall" is not a supported ABI for the current target LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` = 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 #137018 - = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` warning: "cdecl" is not a supported ABI for the current target --> $DIR/unsupported.rs:97:1 @@ -187,9 +187,9 @@ warning: "cdecl" is not a supported ABI for the current target LL | extern "cdecl" fn cdecl() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: use `extern "C"` instead = 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 #137018 - = help: use `extern "C"` instead error: aborting due to 17 previous errors; 9 warnings emitted diff --git a/tests/ui/enum-discriminant/repr-c-big-discriminant1.ptr64.stderr b/tests/ui/enum-discriminant/repr-c-big-discriminant1.ptr64.stderr index e2517ab342f4..2b8326018bc9 100644 --- a/tests/ui/enum-discriminant/repr-c-big-discriminant1.ptr64.stderr +++ b/tests/ui/enum-discriminant/repr-c-big-discriminant1.ptr64.stderr @@ -4,10 +4,10 @@ error: `repr(C)` enum discriminant does not fit into C `int` nor into C `unsigne LL | A = 9223372036854775807, // i64::MAX | ^ | - = 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 #124403 = note: `repr(C)` enums with big discriminants are non-portable, and their size in Rust might not match their size in C = help: use `repr($int_ty)` instead to explicitly set the size of this enum + = 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 #124403 note: the lint level is defined here --> $DIR/repr-c-big-discriminant1.rs:8:9 | @@ -20,10 +20,10 @@ error: `repr(C)` enum discriminant does not fit into C `int` nor into C `unsigne LL | A = -2147483649, // i32::MIN-1 | ^ | - = 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 #124403 = note: `repr(C)` enums with big discriminants are non-portable, and their size in Rust might not match their size in C = help: use `repr($int_ty)` instead to explicitly set the size of this enum + = 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 #124403 error: `repr(C)` enum discriminant does not fit into C `unsigned int`, and a previous discriminant does not fit into C `int` --> $DIR/repr-c-big-discriminant1.rs:36:5 @@ -31,10 +31,10 @@ error: `repr(C)` enum discriminant does not fit into C `unsigned int`, and a pre LL | B = -1, | ^ | - = 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 #124403 = note: `repr(C)` enums with big discriminants are non-portable, and their size in Rust might not match their size in C = help: use `repr($int_ty)` instead to explicitly set the size of this enum + = 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 #124403 error: `repr(C)` enum discriminant does not fit into C `int`, and a previous discriminant does not fit into C `unsigned int` --> $DIR/repr-c-big-discriminant1.rs:43:5 @@ -42,10 +42,10 @@ error: `repr(C)` enum discriminant does not fit into C `int`, and a previous dis LL | A = 2147483648, // i32::MAX+1 | ^ | - = 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 #124403 = note: `repr(C)` enums with big discriminants are non-portable, and their size in Rust might not match their size in C = help: use `repr($int_ty)` instead to explicitly set the size of this enum + = 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 #124403 error: `repr(C)` enum discriminant does not fit into C `int` nor into C `unsigned int` --> $DIR/repr-c-big-discriminant1.rs:53:5 @@ -53,10 +53,10 @@ error: `repr(C)` enum discriminant does not fit into C `int` nor into C `unsigne LL | A = I64_MAX as isize, | ^ | - = 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 #124403 = note: `repr(C)` enums with big discriminants are non-portable, and their size in Rust might not match their size in C = help: use `repr($int_ty)` instead to explicitly set the size of this enum + = 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 #124403 error: aborting due to 5 previous errors diff --git a/tests/ui/enum-discriminant/repr-c-big-discriminant2.ptr64.stderr b/tests/ui/enum-discriminant/repr-c-big-discriminant2.ptr64.stderr index 8cd978ccb2fb..ebf14059b314 100644 --- a/tests/ui/enum-discriminant/repr-c-big-discriminant2.ptr64.stderr +++ b/tests/ui/enum-discriminant/repr-c-big-discriminant2.ptr64.stderr @@ -4,10 +4,10 @@ error: `repr(C)` enum discriminant does not fit into C `int`, and a previous dis LL | B, // +1 | ^ | - = 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 #124403 = note: `repr(C)` enums with big discriminants are non-portable, and their size in Rust might not match their size in C = help: use `repr($int_ty)` instead to explicitly set the size of this enum + = 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 #124403 note: the lint level is defined here --> $DIR/repr-c-big-discriminant2.rs:8:9 | diff --git a/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr b/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr index 5a574636245d..9d945eb23491 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr @@ -9,9 +9,9 @@ LL | | LL | | } | |_^ | + = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` = 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 #137018 - = help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"` = note: `#[warn(unsupported_calling_conventions)]` (part of `#[warn(future_incompatible)]`) on by default error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture diff --git a/tests/ui/lint/future-incompatible-lint-group.stderr b/tests/ui/lint/future-incompatible-lint-group.stderr index ff1e54f5dea3..8f234c621606 100644 --- a/tests/ui/lint/future-incompatible-lint-group.stderr +++ b/tests/ui/lint/future-incompatible-lint-group.stderr @@ -14,8 +14,6 @@ error: ambiguous associated item LL | fn foo() -> Self::V { 0 } | ^^^^^^^ help: use fully-qualified syntax: `::V` | - = 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 #57644 note: `V` could refer to the variant defined here --> $DIR/future-incompatible-lint-group.rs:8:10 | @@ -26,6 +24,8 @@ note: `V` could also refer to the associated type defined here | LL | type V; | ^^^^^^ + = 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 #57644 note: the lint level is defined here --> $DIR/future-incompatible-lint-group.rs:6:9 | diff --git a/tests/ui/lint/improper-ctypes/lint-ctypes.stderr b/tests/ui/lint/improper-ctypes/lint-ctypes.stderr index ef23f3ca6c91..82eacf901d25 100644 --- a/tests/ui/lint/improper-ctypes/lint-ctypes.stderr +++ b/tests/ui/lint/improper-ctypes/lint-ctypes.stderr @@ -218,7 +218,7 @@ warning: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types LL | pub struct TransparentCustomZst(i32, ZeroSize); | ^^^^^^^^ | + = note: this field contains `ZeroSize`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. = 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 #78586 - = note: this field contains `ZeroSize`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. diff --git a/tests/ui/lint/improper-ctypes/lint-fn.stderr b/tests/ui/lint/improper-ctypes/lint-fn.stderr index a0d1ab232c6a..45681cc9f112 100644 --- a/tests/ui/lint/improper-ctypes/lint-fn.stderr +++ b/tests/ui/lint/improper-ctypes/lint-fn.stderr @@ -169,7 +169,7 @@ warning: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types LL | pub struct TransparentCustomZst(i32, ZeroSize); | ^^^^^^^^ | + = note: this field contains `ZeroSize`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. = 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 #78586 - = note: this field contains `ZeroSize`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. diff --git a/tests/ui/repr/repr-transparent-non-exhaustive.stderr b/tests/ui/repr/repr-transparent-non-exhaustive.stderr index ac5493bf7e59..0a575e5f5829 100644 --- a/tests/ui/repr/repr-transparent-non-exhaustive.stderr +++ b/tests/ui/repr/repr-transparent-non-exhaustive.stderr @@ -4,9 +4,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external types wi LL | pub struct T5(Sized, Private); | ^^^^^^^ | + = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -19,9 +19,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T6(Sized, NonExhaustive); | ^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:54:23 @@ -29,9 +29,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T6a(Sized, ::Assoc); // normalizes to `NonExhaustive` | ^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:59:22 @@ -39,9 +39,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T7(Sized, NonExhaustiveEnum); | ^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:64:22 @@ -49,9 +49,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T8(Sized, NonExhaustiveVariant); | ^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external types with private fields --> $DIR/repr-transparent-non-exhaustive.rs:69:22 @@ -59,9 +59,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external types wi LL | pub struct T9(Sized, InternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:74:23 @@ -69,9 +69,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T10(Sized, InternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:79:23 @@ -79,9 +79,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T11(Sized, InternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:84:23 @@ -89,9 +89,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T12(Sized, InternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external types with private fields --> $DIR/repr-transparent-non-exhaustive.rs:89:23 @@ -99,9 +99,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external types wi LL | pub struct T13(Sized, ExternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:94:23 @@ -109,9 +109,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T14(Sized, ExternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:99:23 @@ -119,9 +119,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T15(Sized, ExternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:104:23 @@ -129,9 +129,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T16(Sized, ExternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:109:16 @@ -139,9 +139,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T17(NonExhaustive, Sized); | ^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:114:31 @@ -149,9 +149,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T18(NonExhaustive, NonExhaustive); | ^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external types with private fields --> $DIR/repr-transparent-non-exhaustive.rs:119:31 @@ -159,9 +159,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external types wi LL | pub struct T19(NonExhaustive, Private); | ^^^^^^^ | + = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types --> $DIR/repr-transparent-non-exhaustive.rs:124:32 @@ -169,9 +169,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T19Flipped(Private, NonExhaustive); | ^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. error: aborting due to 17 previous errors @@ -182,9 +182,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external types wi LL | pub struct T5(Sized, Private); | ^^^^^^^ | + = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -198,9 +198,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T6(Sized, NonExhaustive); | ^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -214,9 +214,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T6a(Sized, ::Assoc); // normalizes to `NonExhaustive` | ^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -230,9 +230,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T7(Sized, NonExhaustiveEnum); | ^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -246,9 +246,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T8(Sized, NonExhaustiveVariant); | ^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -262,9 +262,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external types wi LL | pub struct T9(Sized, InternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -278,9 +278,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T10(Sized, InternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -294,9 +294,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T11(Sized, InternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -310,9 +310,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T12(Sized, InternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -326,9 +326,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external types wi LL | pub struct T13(Sized, ExternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -342,9 +342,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T14(Sized, ExternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -358,9 +358,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T15(Sized, ExternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveEnum`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -374,9 +374,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T16(Sized, ExternalIndirection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -390,9 +390,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T17(NonExhaustive, Sized); | ^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -406,9 +406,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T18(NonExhaustive, NonExhaustive); | ^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -422,9 +422,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external types wi LL | pub struct T19(NonExhaustive, Private); | ^^^^^^^ | + = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `Private`, which contains private fields, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | @@ -438,9 +438,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain external non-exha LL | pub struct T19Flipped(Private, NonExhaustive); | ^^^^^^^^^^^^^ | + = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. = 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 #78586 - = note: this field contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, so it could become non-zero-sized in the future. note: the lint level is defined here --> $DIR/repr-transparent-non-exhaustive.rs:1:9 | diff --git a/tests/ui/repr/repr-transparent-repr-c.stderr b/tests/ui/repr/repr-transparent-repr-c.stderr index 5724845afdc1..2a670fed8070 100644 --- a/tests/ui/repr/repr-transparent-repr-c.stderr +++ b/tests/ui/repr/repr-transparent-repr-c.stderr @@ -4,9 +4,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types LL | pub struct T5(Sized, ReprC1Zst); | ^^^^^^^^^ | + = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. = 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 #78586 - = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. note: the lint level is defined here --> $DIR/repr-transparent-repr-c.rs:1:9 | @@ -19,9 +19,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types LL | pub struct T6(ReprC1Zst, Sized); | ^^^^^^^^^ | + = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. = 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 #78586 - = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. error: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types --> $DIR/repr-transparent-repr-c.rs:28:15 @@ -29,9 +29,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types LL | pub struct T7(T1, Sized); // still wrong, even when the repr(C) is hidden inside another type | ^^ | + = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. = 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 #78586 - = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. error: aborting due to 3 previous errors @@ -42,9 +42,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types LL | pub struct T5(Sized, ReprC1Zst); | ^^^^^^^^^ | + = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. = 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 #78586 - = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. note: the lint level is defined here --> $DIR/repr-transparent-repr-c.rs:1:9 | @@ -58,9 +58,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types LL | pub struct T6(ReprC1Zst, Sized); | ^^^^^^^^^ | + = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. = 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 #78586 - = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. note: the lint level is defined here --> $DIR/repr-transparent-repr-c.rs:1:9 | @@ -74,9 +74,9 @@ error: zero-sized fields in `repr(transparent)` cannot contain `repr(C)` types LL | pub struct T7(T1, Sized); // still wrong, even when the repr(C) is hidden inside another type | ^^ | + = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. = 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 #78586 - = note: this field contains `ReprC1Zst`, which is a `#[repr(C)]` type, so it is not guaranteed to be zero-sized on all targets. note: the lint level is defined here --> $DIR/repr-transparent-repr-c.rs:1:9 | diff --git a/tests/ui/statics/uninhabited-static.stderr b/tests/ui/statics/uninhabited-static.stderr index a0f9ad6772de..4762784574dc 100644 --- a/tests/ui/statics/uninhabited-static.stderr +++ b/tests/ui/statics/uninhabited-static.stderr @@ -4,9 +4,9 @@ error: static of uninhabited type LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^ | + = note: uninhabited statics cannot be initialized, and any access would be an immediate error = 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 #74840 - = note: uninhabited statics cannot be initialized, and any access would be an immediate error note: the lint level is defined here --> $DIR/uninhabited-static.rs:2:9 | @@ -19,9 +19,9 @@ error: static of uninhabited type LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^^ | + = note: uninhabited statics cannot be initialized, and any access would be an immediate error = 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 #74840 - = note: uninhabited statics cannot be initialized, and any access would be an immediate error error: static of uninhabited type --> $DIR/uninhabited-static.rs:6:5 @@ -29,9 +29,9 @@ error: static of uninhabited type LL | static VOID: Void; | ^^^^^^^^^^^^^^^^^ | + = note: uninhabited statics cannot be initialized, and any access would be an immediate error = 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 #74840 - = note: uninhabited statics cannot be initialized, and any access would be an immediate error error: static of uninhabited type --> $DIR/uninhabited-static.rs:8:5 @@ -39,9 +39,9 @@ error: static of uninhabited type LL | static NEVER: !; | ^^^^^^^^^^^^^^^ | + = note: uninhabited statics cannot be initialized, and any access would be an immediate error = 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 #74840 - = note: uninhabited statics cannot be initialized, and any access would be an immediate error error[E0080]: constructing invalid value: encountered a value of uninhabited type `Void` --> $DIR/uninhabited-static.rs:12:31 diff --git a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr index 79bd1f2adc17..918d05b5d678 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr @@ -4,8 +4,6 @@ error: ambiguous associated item LL | fn f() -> Self::V { 0 } | ^^^^^^^ help: use fully-qualified syntax: `::V` | - = 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 #57644 note: `V` could refer to the variant defined here --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:22:5 | @@ -16,6 +14,8 @@ note: `V` could also refer to the associated type defined here | LL | type V; | ^^^^^^ + = 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 #57644 = note: `#[deny(ambiguous_associated_items)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error