]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_borrowck/src/session_diagnostics.rs
Auto merge of #97925 - the8472:cgroupv1, r=joshtriplett
[rust.git] / compiler / rustc_borrowck / src / session_diagnostics.rs
1 use rustc_macros::{SessionDiagnostic, SessionSubdiagnostic};
2 use rustc_middle::ty::Ty;
3 use rustc_span::Span;
4
5 #[derive(SessionDiagnostic)]
6 #[error(borrowck::move_unsized, code = "E0161")]
7 pub(crate) struct MoveUnsized<'tcx> {
8     pub ty: Ty<'tcx>,
9     #[primary_span]
10     #[label]
11     pub span: Span,
12 }
13
14 #[derive(SessionDiagnostic)]
15 #[error(borrowck::higher_ranked_lifetime_error)]
16 pub(crate) struct HigherRankedLifetimeError {
17     #[subdiagnostic]
18     pub cause: Option<HigherRankedErrorCause>,
19     #[primary_span]
20     pub span: Span,
21 }
22
23 #[derive(SessionSubdiagnostic)]
24 pub(crate) enum HigherRankedErrorCause {
25     #[note(borrowck::could_not_prove)]
26     CouldNotProve { predicate: String },
27     #[note(borrowck::could_not_normalize)]
28     CouldNotNormalize { value: String },
29 }
30
31 #[derive(SessionDiagnostic)]
32 #[error(borrowck::higher_ranked_subtype_error)]
33 pub(crate) struct HigherRankedSubtypeError {
34     #[primary_span]
35     pub span: Span,
36 }
37
38 #[derive(SessionDiagnostic)]
39 #[error(borrowck::generic_does_not_live_long_enough)]
40 pub(crate) struct GenericDoesNotLiveLongEnough {
41     pub kind: String,
42     #[primary_span]
43     pub span: Span,
44 }