]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_middle/src/error.rs
Auto merge of #104875 - chenyukang:yukang/fix-104867-inc, r=estebank
[rust.git] / compiler / rustc_middle / src / error.rs
1 use rustc_macros::Diagnostic;
2 use rustc_span::Span;
3
4 use crate::ty::Ty;
5
6 #[derive(Diagnostic)]
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(Diagnostic)]
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(Subdiagnostic)]
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(Diagnostic)]
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 }
51
52 #[derive(Diagnostic)]
53 #[diag(middle_const_eval_non_int)]
54 pub struct ConstEvalNonIntError {
55     #[primary_span]
56     pub span: Span,
57 }
58
59 #[derive(Diagnostic)]
60 #[diag(middle_strict_coherence_needs_negative_coherence)]
61 pub(crate) struct StrictCoherenceNeedsNegativeCoherence {
62     #[primary_span]
63     pub span: Span,
64     #[label]
65     pub attr_span: Option<Span>,
66 }
67
68 #[derive(Diagnostic)]
69 #[diag(middle_const_not_used_in_type_alias)]
70 pub(super) struct ConstNotUsedTraitAlias {
71     pub ct: String,
72     #[primary_span]
73     pub span: Span,
74 }