]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_middle/src/error.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / compiler / rustc_middle / src / error.rs
1 use rustc_macros::SessionDiagnostic;
2 use rustc_span::Span;
3
4 use crate::ty::Ty;
5
6 #[derive(SessionDiagnostic)]
7 #[diag(middle::drop_check_overflow, code = "E0320")]
8 #[note]
9 pub struct DropCheckOverflow<'tcx> {
10 #[primary_span]
11 pub span: Span,
12 pub ty: Ty<'tcx>,
13 pub overflow_ty: Ty<'tcx>,
14 }
15
16 #[derive(SessionDiagnostic)]
17 #[diag(middle::opaque_hidden_type_mismatch)]
18 pub struct OpaqueHiddenTypeMismatch<'tcx> {
19 pub self_ty: Ty<'tcx>,
20 pub other_ty: Ty<'tcx>,
21 #[primary_span]
22 #[label]
23 pub other_span: Span,
24 #[subdiagnostic]
25 pub sub: TypeMismatchReason,
26 }
27
28 #[derive(SessionSubdiagnostic)]
29 pub enum TypeMismatchReason {
30 #[label(middle::conflict_types)]
31 ConflictType {
32 #[primary_span]
33 span: Span,
34 },
35 #[note(middle::previous_use_here)]
36 PreviousUse {
37 #[primary_span]
38 span: Span,
39 },
40 }
41
42 #[derive(SessionDiagnostic)]
43 #[diag(middle::limit_invalid)]
44 pub struct LimitInvalid<'a> {
45 #[primary_span]
46 pub span: Span,
47 #[label]
48 pub value_span: Span,
49 pub error_str: &'a str,
50 }