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