rustc_monomorphize/
errors.rs

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