rustc_ty_utils/
errors.rs
1use rustc_errors::codes::*;
4use rustc_macros::{Diagnostic, Subdiagnostic};
5use rustc_middle::ty::{GenericArg, Ty};
6use rustc_span::Span;
7
8#[derive(Diagnostic)]
9#[diag(ty_utils_needs_drop_overflow)]
10pub(crate) struct NeedsDropOverflow<'tcx> {
11 pub query_ty: Ty<'tcx>,
12}
13
14#[derive(Diagnostic)]
15#[diag(ty_utils_generic_constant_too_complex)]
16#[help]
17pub(crate) struct GenericConstantTooComplex {
18 #[primary_span]
19 pub span: Span,
20 #[note(ty_utils_maybe_supported)]
21 pub maybe_supported: bool,
22 #[subdiagnostic]
23 pub sub: GenericConstantTooComplexSub,
24}
25
26#[derive(Subdiagnostic)]
27pub(crate) enum GenericConstantTooComplexSub {
28 #[label(ty_utils_borrow_not_supported)]
29 BorrowNotSupported(#[primary_span] Span),
30 #[label(ty_utils_address_and_deref_not_supported)]
31 AddressAndDerefNotSupported(#[primary_span] Span),
32 #[label(ty_utils_array_not_supported)]
33 ArrayNotSupported(#[primary_span] Span),
34 #[label(ty_utils_block_not_supported)]
35 BlockNotSupported(#[primary_span] Span),
36 #[label(ty_utils_never_to_any_not_supported)]
37 NeverToAnyNotSupported(#[primary_span] Span),
38 #[label(ty_utils_tuple_not_supported)]
39 TupleNotSupported(#[primary_span] Span),
40 #[label(ty_utils_index_not_supported)]
41 IndexNotSupported(#[primary_span] Span),
42 #[label(ty_utils_field_not_supported)]
43 FieldNotSupported(#[primary_span] Span),
44 #[label(ty_utils_const_block_not_supported)]
45 ConstBlockNotSupported(#[primary_span] Span),
46 #[label(ty_utils_adt_not_supported)]
47 AdtNotSupported(#[primary_span] Span),
48 #[label(ty_utils_pointer_not_supported)]
49 PointerNotSupported(#[primary_span] Span),
50 #[label(ty_utils_yield_not_supported)]
51 YieldNotSupported(#[primary_span] Span),
52 #[label(ty_utils_loop_not_supported)]
53 LoopNotSupported(#[primary_span] Span),
54 #[label(ty_utils_box_not_supported)]
55 BoxNotSupported(#[primary_span] Span),
56 #[label(ty_utils_binary_not_supported)]
57 BinaryNotSupported(#[primary_span] Span),
58 #[label(ty_utils_logical_op_not_supported)]
59 LogicalOpNotSupported(#[primary_span] Span),
60 #[label(ty_utils_assign_not_supported)]
61 AssignNotSupported(#[primary_span] Span),
62 #[label(ty_utils_closure_and_return_not_supported)]
63 ClosureAndReturnNotSupported(#[primary_span] Span),
64 #[label(ty_utils_control_flow_not_supported)]
65 ControlFlowNotSupported(#[primary_span] Span),
66 #[label(ty_utils_inline_asm_not_supported)]
67 InlineAsmNotSupported(#[primary_span] Span),
68 #[label(ty_utils_operation_not_supported)]
69 OperationNotSupported(#[primary_span] Span),
70}
71
72#[derive(Diagnostic)]
73#[diag(ty_utils_unexpected_fnptr_associated_item)]
74pub(crate) struct UnexpectedFnPtrAssociatedItem {
75 #[primary_span]
76 pub span: Span,
77}
78
79#[derive(Diagnostic)]
80#[diag(ty_utils_zero_length_simd_type)]
81pub(crate) struct ZeroLengthSimdType<'tcx> {
82 pub ty: Ty<'tcx>,
83}
84
85#[derive(Diagnostic)]
86#[diag(ty_utils_multiple_array_fields_simd_type)]
87pub(crate) struct MultipleArrayFieldsSimdType<'tcx> {
88 pub ty: Ty<'tcx>,
89}
90
91#[derive(Diagnostic)]
92#[diag(ty_utils_oversized_simd_type)]
93pub(crate) struct OversizedSimdType<'tcx> {
94 pub ty: Ty<'tcx>,
95 pub max_lanes: u64,
96}
97
98#[derive(Diagnostic)]
99#[diag(ty_utils_non_primitive_simd_type)]
100pub(crate) struct NonPrimitiveSimdType<'tcx> {
101 pub ty: Ty<'tcx>,
102 pub e_ty: Ty<'tcx>,
103}
104
105#[derive(Diagnostic)]
106#[diag(ty_utils_impl_trait_duplicate_arg)]
107pub(crate) struct DuplicateArg<'tcx> {
108 pub arg: GenericArg<'tcx>,
109 #[primary_span]
110 #[label]
111 pub span: Span,
112 #[note]
113 pub opaque_span: Span,
114}
115
116#[derive(Diagnostic)]
117#[diag(ty_utils_impl_trait_not_param, code = E0792)]
118pub(crate) struct NotParam<'tcx> {
119 pub arg: GenericArg<'tcx>,
120 #[primary_span]
121 #[label]
122 pub span: Span,
123 #[note]
124 pub opaque_span: Span,
125}