From cf94bdc0742c13e2a0cac864c478b8626b266e1b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_borrowck/src/session_diagnostics.rs | 71 ++++++++++------------ 1 file changed, 31 insertions(+), 40 deletions(-) (limited to 'compiler/rustc_borrowck/src/session_diagnostics.rs') diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs index 5d750c6ca..cff3089c3 100644 --- a/compiler/rustc_borrowck/src/session_diagnostics.rs +++ b/compiler/rustc_borrowck/src/session_diagnostics.rs @@ -1,12 +1,12 @@ use rustc_errors::{IntoDiagnosticArg, MultiSpan}; -use rustc_macros::{LintDiagnostic, SessionDiagnostic, SessionSubdiagnostic}; +use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; use rustc_middle::ty::Ty; use rustc_span::Span; use crate::diagnostics::RegionName; -#[derive(SessionDiagnostic)] -#[diag(borrowck::move_unsized, code = "E0161")] +#[derive(Diagnostic)] +#[diag(borrowck_move_unsized, code = "E0161")] pub(crate) struct MoveUnsized<'tcx> { pub ty: Ty<'tcx>, #[primary_span] @@ -14,8 +14,8 @@ pub(crate) struct MoveUnsized<'tcx> { pub span: Span, } -#[derive(SessionDiagnostic)] -#[diag(borrowck::higher_ranked_lifetime_error)] +#[derive(Diagnostic)] +#[diag(borrowck_higher_ranked_lifetime_error)] pub(crate) struct HigherRankedLifetimeError { #[subdiagnostic] pub cause: Option, @@ -23,23 +23,23 @@ pub(crate) struct HigherRankedLifetimeError { pub span: Span, } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] pub(crate) enum HigherRankedErrorCause { - #[note(borrowck::could_not_prove)] + #[note(borrowck_could_not_prove)] CouldNotProve { predicate: String }, - #[note(borrowck::could_not_normalize)] + #[note(borrowck_could_not_normalize)] CouldNotNormalize { value: String }, } -#[derive(SessionDiagnostic)] -#[diag(borrowck::higher_ranked_subtype_error)] +#[derive(Diagnostic)] +#[diag(borrowck_higher_ranked_subtype_error)] pub(crate) struct HigherRankedSubtypeError { #[primary_span] pub span: Span, } -#[derive(SessionDiagnostic)] -#[diag(borrowck::generic_does_not_live_long_enough)] +#[derive(Diagnostic)] +#[diag(borrowck_generic_does_not_live_long_enough)] pub(crate) struct GenericDoesNotLiveLongEnough { pub kind: String, #[primary_span] @@ -47,24 +47,15 @@ pub(crate) struct GenericDoesNotLiveLongEnough { } #[derive(LintDiagnostic)] -#[diag(borrowck::var_does_not_need_mut)] +#[diag(borrowck_var_does_not_need_mut)] pub(crate) struct VarNeedNotMut { #[suggestion_short(applicability = "machine-applicable", code = "")] pub span: Span, } - -#[derive(SessionDiagnostic)] -#[diag(borrowck::const_not_used_in_type_alias)] -pub(crate) struct ConstNotUsedTraitAlias { - pub ct: String, - #[primary_span] - pub span: Span, -} - -#[derive(SessionDiagnostic)] -#[diag(borrowck::var_cannot_escape_closure)] +#[derive(Diagnostic)] +#[diag(borrowck_var_cannot_escape_closure)] #[note] -#[note(borrowck::cannot_escape)] +#[note(cannot_escape)] pub(crate) struct FnMutError { #[primary_span] pub span: Span, @@ -72,54 +63,54 @@ pub(crate) struct FnMutError { pub ty_err: FnMutReturnTypeErr, } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] pub(crate) enum VarHereDenote { - #[label(borrowck::var_here_captured)] + #[label(borrowck_var_here_captured)] Captured { #[primary_span] span: Span, }, - #[label(borrowck::var_here_defined)] + #[label(borrowck_var_here_defined)] Defined { #[primary_span] span: Span, }, - #[label(borrowck::closure_inferred_mut)] + #[label(borrowck_closure_inferred_mut)] FnMutInferred { #[primary_span] span: Span, }, } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] pub(crate) enum FnMutReturnTypeErr { - #[label(borrowck::returned_closure_escaped)] + #[label(borrowck_returned_closure_escaped)] ReturnClosure { #[primary_span] span: Span, }, - #[label(borrowck::returned_async_block_escaped)] + #[label(borrowck_returned_async_block_escaped)] ReturnAsyncBlock { #[primary_span] span: Span, }, - #[label(borrowck::returned_ref_escaped)] + #[label(borrowck_returned_ref_escaped)] ReturnRef { #[primary_span] span: Span, }, } -#[derive(SessionDiagnostic)] -#[diag(borrowck::lifetime_constraints_error)] +#[derive(Diagnostic)] +#[diag(borrowck_lifetime_constraints_error)] pub(crate) struct LifetimeOutliveErr { #[primary_span] pub span: Span, } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] pub(crate) enum LifetimeReturnCategoryErr<'a> { - #[label(borrowck::returned_lifetime_wrong)] + #[label(borrowck_returned_lifetime_wrong)] WrongReturn { #[primary_span] span: Span, @@ -127,7 +118,7 @@ pub(crate) enum LifetimeReturnCategoryErr<'a> { outlived_fr_name: RegionName, fr_name: &'a RegionName, }, - #[label(borrowck::returned_lifetime_short)] + #[label(borrowck_returned_lifetime_short)] ShortReturn { #[primary_span] span: Span, @@ -149,9 +140,9 @@ impl IntoDiagnosticArg for RegionName { } } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] pub(crate) enum RequireStaticErr { - #[note(borrowck::used_impl_require_static)] + #[note(borrowck_used_impl_require_static)] UsedImpl { #[primary_span] multi_span: MultiSpan, -- cgit v1.2.3