rustc_monomorphize/
errors.rs

1use rustc_macros::{Diagnostic, LintDiagnostic};
2use rustc_middle::ty::{Instance, Ty};
3use rustc_span::{Span, Symbol};
4
5#[derive(Diagnostic)]
6#[diag(monomorphize_recursion_limit)]
7pub(crate) struct RecursionLimit<'tcx> {
8    #[primary_span]
9    pub span: Span,
10    pub instance: Instance<'tcx>,
11    #[note]
12    pub def_span: Span,
13    pub def_path_str: String,
14}
15
16#[derive(Diagnostic)]
17#[diag(monomorphize_no_optimized_mir)]
18pub(crate) struct NoOptimizedMir {
19    #[note]
20    pub span: Span,
21    pub crate_name: Symbol,
22    pub instance: String,
23}
24
25#[derive(LintDiagnostic)]
26#[diag(monomorphize_large_assignments)]
27#[note]
28pub(crate) struct LargeAssignmentsLint {
29    #[label]
30    pub span: Span,
31    pub size: u64,
32    pub limit: u64,
33}
34
35#[derive(Diagnostic)]
36#[diag(monomorphize_symbol_already_defined)]
37pub(crate) struct SymbolAlreadyDefined {
38    #[primary_span]
39    pub span: Option<Span>,
40    pub symbol: String,
41}
42
43#[derive(Diagnostic)]
44#[diag(monomorphize_couldnt_dump_mono_stats)]
45pub(crate) struct CouldntDumpMonoStats {
46    pub error: String,
47}
48
49#[derive(Diagnostic)]
50#[diag(monomorphize_encountered_error_while_instantiating)]
51pub(crate) struct EncounteredErrorWhileInstantiating<'tcx> {
52    #[primary_span]
53    pub span: Span,
54    pub kind: &'static str,
55    pub instance: Instance<'tcx>,
56}
57
58#[derive(Diagnostic)]
59#[diag(monomorphize_encountered_error_while_instantiating_global_asm)]
60pub(crate) struct EncounteredErrorWhileInstantiatingGlobalAsm {
61    #[primary_span]
62    pub span: Span,
63}
64
65#[derive(Diagnostic)]
66#[diag(monomorphize_start_not_found)]
67#[help]
68pub(crate) struct StartNotFound;
69
70#[derive(Diagnostic)]
71#[diag(monomorphize_abi_error_disabled_vector_type)]
72#[help]
73pub(crate) struct AbiErrorDisabledVectorType<'a> {
74    #[primary_span]
75    #[label]
76    pub span: Span,
77    pub required_feature: &'a str,
78    pub ty: Ty<'a>,
79    /// Whether this is a problem at a call site or at a declaration.
80    pub is_call: bool,
81    /// Whether this is a problem with a fixed length vector or a scalable vector
82    pub is_scalable: bool,
83}
84
85#[derive(Diagnostic)]
86#[diag(monomorphize_abi_error_unsupported_unsized_parameter)]
87#[help]
88pub(crate) struct AbiErrorUnsupportedUnsizedParameter<'a> {
89    #[primary_span]
90    #[label]
91    pub span: Span,
92    pub ty: Ty<'a>,
93    /// Whether this is a problem at a call site or at a declaration.
94    pub is_call: bool,
95}
96
97#[derive(Diagnostic)]
98#[diag(monomorphize_abi_error_unsupported_vector_type)]
99pub(crate) struct AbiErrorUnsupportedVectorType<'a> {
100    #[primary_span]
101    #[label]
102    pub span: Span,
103    pub ty: Ty<'a>,
104    /// Whether this is a problem at a call site or at a declaration.
105    pub is_call: bool,
106}
107
108#[derive(Diagnostic)]
109#[diag(monomorphize_abi_required_target_feature)]
110#[help]
111pub(crate) struct AbiRequiredTargetFeature<'a> {
112    #[primary_span]
113    #[label]
114    pub span: Span,
115    pub required_feature: &'a str,
116    pub abi: &'a str,
117    /// Whether this is a problem at a call site or at a declaration.
118    pub is_call: bool,
119}