2022-08-18 18:04:31 -05:00
|
|
|
//! Errors emitted by ty_utils
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
use rustc_macros::{Diagnostic, Subdiagnostic};
|
2023-04-25 03:07:44 -05:00
|
|
|
use rustc_middle::ty::{GenericArg, Ty};
|
2022-08-18 18:04:31 -05:00
|
|
|
use rustc_span::Span;
|
|
|
|
|
2022-09-18 10:46:56 -05:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ty_utils_needs_drop_overflow)]
|
2022-08-18 18:04:31 -05:00
|
|
|
pub struct NeedsDropOverflow<'tcx> {
|
|
|
|
pub query_ty: Ty<'tcx>,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:46:56 -05:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ty_utils_generic_constant_too_complex)]
|
2022-08-18 18:04:31 -05:00
|
|
|
#[help]
|
|
|
|
pub struct GenericConstantTooComplex {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
2022-10-13 04:13:02 -05:00
|
|
|
#[note(ty_utils_maybe_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
pub maybe_supported: Option<()>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sub: GenericConstantTooComplexSub,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-08-18 18:04:31 -05:00
|
|
|
pub enum GenericConstantTooComplexSub {
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_borrow_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
BorrowNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_address_and_deref_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
AddressAndDerefNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_array_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
ArrayNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_block_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
BlockNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_never_to_any_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
NeverToAnyNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_tuple_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
TupleNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_index_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
IndexNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_field_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
FieldNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_const_block_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
ConstBlockNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_adt_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
AdtNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_pointer_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
PointerNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_yield_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
YieldNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_loop_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
LoopNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_box_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
BoxNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_binary_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
BinaryNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_logical_op_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
LogicalOpNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_assign_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
AssignNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_closure_and_return_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
ClosureAndReturnNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_control_flow_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
ControlFlowNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_inline_asm_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
InlineAsmNotSupported(#[primary_span] Span),
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ty_utils_operation_not_supported)]
|
2022-08-18 18:04:31 -05:00
|
|
|
OperationNotSupported(#[primary_span] Span),
|
|
|
|
}
|
2023-04-07 13:45:17 -05:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ty_utils_unexpected_fnptr_associated_item)]
|
|
|
|
pub struct UnexpectedFnPtrAssociatedItem {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2023-04-08 14:01:14 -05:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ty_utils_zero_length_simd_type)]
|
|
|
|
pub struct ZeroLengthSimdType<'tcx> {
|
|
|
|
pub ty: Ty<'tcx>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ty_utils_multiple_array_fields_simd_type)]
|
|
|
|
pub struct MultipleArrayFieldsSimdType<'tcx> {
|
|
|
|
pub ty: Ty<'tcx>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ty_utils_oversized_simd_type)]
|
|
|
|
pub struct OversizedSimdType<'tcx> {
|
|
|
|
pub ty: Ty<'tcx>,
|
|
|
|
pub max_lanes: u64,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
2023-04-10 15:02:52 -05:00
|
|
|
#[diag(ty_utils_non_primitive_simd_type)]
|
2023-04-08 14:01:14 -05:00
|
|
|
pub struct NonPrimitiveSimdType<'tcx> {
|
|
|
|
pub ty: Ty<'tcx>,
|
|
|
|
pub e_ty: Ty<'tcx>,
|
|
|
|
}
|
2023-04-25 03:07:44 -05:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ty_utils_impl_trait_duplicate_arg)]
|
|
|
|
pub struct DuplicateArg<'tcx> {
|
|
|
|
pub arg: GenericArg<'tcx>,
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[note]
|
|
|
|
pub opaque_span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
2023-06-16 15:20:39 -05:00
|
|
|
#[diag(ty_utils_impl_trait_not_param, code = "E0792")]
|
2023-04-25 03:07:44 -05:00
|
|
|
pub struct NotParam<'tcx> {
|
|
|
|
pub arg: GenericArg<'tcx>,
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[note]
|
|
|
|
pub opaque_span: Span,
|
|
|
|
}
|