summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_gcc/src/errors.rs
blob: d0ba7e2479111fed3ee8661f86984a3fbfd18cf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg};
use rustc_macros::Diagnostic;
use rustc_middle::ty::Ty;
use rustc_span::{Span, Symbol};
use std::borrow::Cow;

struct ExitCode(Option<i32>);

impl IntoDiagnosticArg for ExitCode {
    fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
        let ExitCode(exit_code) = self;
        match exit_code {
            Some(t) => t.into_diagnostic_arg(),
            None => DiagnosticArgValue::Str(Cow::Borrowed("<signal>")),
        }
    }
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_basic_integer, code = "E0511")]
pub(crate) struct InvalidMonomorphizationBasicInteger<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_invalid_float_vector, code = "E0511")]
pub(crate) struct InvalidMonomorphizationInvalidFloatVector<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub elem_ty: &'a str,
    pub vec_ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_not_float, code = "E0511")]
pub(crate) struct InvalidMonomorphizationNotFloat<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_unrecognized, code = "E0511")]
pub(crate) struct InvalidMonomorphizationUnrecognized {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_expected_signed_unsigned, code = "E0511")]
pub(crate) struct InvalidMonomorphizationExpectedSignedUnsigned<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub elem_ty: Ty<'a>,
    pub vec_ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_unsupported_element, code = "E0511")]
pub(crate) struct InvalidMonomorphizationUnsupportedElement<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub in_ty: Ty<'a>,
    pub elem_ty: Ty<'a>,
    pub ret_ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_invalid_bitmask, code = "E0511")]
pub(crate) struct InvalidMonomorphizationInvalidBitmask<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub ty: Ty<'a>,
    pub expected_int_bits: u64,
    pub expected_bytes: u64,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_simd_shuffle, code = "E0511")]
pub(crate) struct InvalidMonomorphizationSimdShuffle<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_expected_simd, code = "E0511")]
pub(crate) struct InvalidMonomorphizationExpectedSimd<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub position: &'a str,
    pub found_ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_mask_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationMaskType<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_return_length, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnLength<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub in_len: u64,
    pub ret_ty: Ty<'a>,
    pub out_len: u64,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_return_length_input_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnLengthInputType<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub in_len: u64,
    pub in_ty: Ty<'a>,
    pub ret_ty: Ty<'a>,
    pub out_len: u64,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_return_element, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnElement<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub in_elem: Ty<'a>,
    pub in_ty: Ty<'a>,
    pub ret_ty: Ty<'a>,
    pub out_ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_return_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnType<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub in_elem: Ty<'a>,
    pub in_ty: Ty<'a>,
    pub ret_ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_inserted_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationInsertedType<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub in_elem: Ty<'a>,
    pub in_ty: Ty<'a>,
    pub out_ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_return_integer_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnIntegerType<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub ret_ty: Ty<'a>,
    pub out_ty: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_mismatched_lengths, code = "E0511")]
pub(crate) struct InvalidMonomorphizationMismatchedLengths {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub m_len: u64,
    pub v_len: u64,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_unsupported_cast, code = "E0511")]
pub(crate) struct InvalidMonomorphizationUnsupportedCast<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub in_ty: Ty<'a>,
    pub in_elem: Ty<'a>,
    pub ret_ty: Ty<'a>,
    pub out_elem: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_monomorphization_unsupported_operation, code = "E0511")]
pub(crate) struct InvalidMonomorphizationUnsupportedOperation<'a> {
    #[primary_span]
    pub span: Span,
    pub name: Symbol,
    pub in_ty: Ty<'a>,
    pub in_elem: Ty<'a>,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_lto_not_supported)]
pub(crate) struct LTONotSupported;

#[derive(Diagnostic)]
#[diag(codegen_gcc_unwinding_inline_asm)]
pub(crate) struct UnwindingInlineAsm {
    #[primary_span]
    pub span: Span,
}