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}
82
83#[derive(Diagnostic)]
84#[diag(monomorphize_abi_error_unsupported_vector_type)]
85pub(crate) struct AbiErrorUnsupportedVectorType<'a> {
86    #[primary_span]
87    #[label]
88    pub span: Span,
89    pub ty: Ty<'a>,
90    /// Whether this is a problem at a call site or at a declaration.
91    pub is_call: bool,
92}
93
94#[derive(Diagnostic)]
95#[diag(monomorphize_abi_required_target_feature)]
96#[help]
97pub(crate) struct AbiRequiredTargetFeature<'a> {
98    #[primary_span]
99    #[label]
100    pub span: Span,
101    pub required_feature: &'a str,
102    pub abi: &'a str,
103    /// Whether this is a problem at a call site or at a declaration.
104    pub is_call: bool,
105}