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}
28
29#[derive(LintDiagnostic)]
30#[diag(monomorphize_large_assignments)]
31#[note]
32pub(crate) struct LargeAssignmentsLint {
33    #[label]
34    pub span: Span,
35    pub size: u64,
36    pub limit: u64,
37}
38
39#[derive(Diagnostic)]
40#[diag(monomorphize_symbol_already_defined)]
41pub(crate) struct SymbolAlreadyDefined {
42    #[primary_span]
43    pub span: Option<Span>,
44    pub symbol: String,
45}
46
47#[derive(Diagnostic)]
48#[diag(monomorphize_couldnt_dump_mono_stats)]
49pub(crate) struct CouldntDumpMonoStats {
50    pub error: String,
51}
52
53#[derive(Diagnostic)]
54#[diag(monomorphize_encountered_error_while_instantiating)]
55pub(crate) struct EncounteredErrorWhileInstantiating {
56    #[primary_span]
57    pub span: Span,
58    pub formatted_item: String,
59}
60
61#[derive(Diagnostic)]
62#[diag(monomorphize_start_not_found)]
63#[help]
64pub(crate) struct StartNotFound;
65
66#[derive(Diagnostic)]
67#[diag(monomorphize_unknown_cgu_collection_mode)]
68pub(crate) struct UnknownCguCollectionMode<'a> {
69    pub mode: &'a str,
70}
71
72#[derive(LintDiagnostic)]
73#[diag(monomorphize_abi_error_disabled_vector_type)]
74#[help]
75pub(crate) struct AbiErrorDisabledVectorType<'a> {
76    #[label]
77    pub span: Span,
78    pub required_feature: &'a str,
79    pub ty: Ty<'a>,
80    /// Whether this is a problem at a call site or at a declaration.
81    pub is_call: bool,
82}
83
84#[derive(LintDiagnostic)]
85#[diag(monomorphize_abi_error_unsupported_vector_type)]
86pub(crate) struct AbiErrorUnsupportedVectorType<'a> {
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}
106
107#[derive(LintDiagnostic)]
108#[diag(monomorphize_wasm_c_abi_transition)]
109#[help]
110pub(crate) struct WasmCAbiTransition<'a> {
111    pub ty: Ty<'a>,
112    /// Whether this is a problem at a call site or at a declaration.
113    pub is_call: bool,
114}