1 use rustc_errors::DiagnosticArgFromDisplay;
2 use rustc_macros::{Diagnostic, Subdiagnostic};
3 use rustc_span::{symbol::Ident, Span, Symbol};
5 #[derive(Diagnostic, Clone, Copy)]
6 #[diag(ast_lowering_generic_type_with_parentheses, code = "E0214")]
7 pub struct GenericTypeWithParentheses {
12 pub sub: Option<UseAngleBrackets>,
15 #[derive(Clone, Copy, Subdiagnostic)]
16 #[multipart_suggestion(ast_lowering_use_angle_brackets, applicability = "maybe-incorrect")]
17 pub struct UseAngleBrackets {
18 #[suggestion_part(code = "<")]
20 #[suggestion_part(code = ">")]
21 pub close_param: Span,
25 #[diag(ast_lowering_invalid_abi, code = "E0703")]
27 pub struct InvalidAbi {
34 pub suggestion: Option<InvalidAbiSuggestion>,
37 #[derive(Subdiagnostic)]
39 ast_lowering_invalid_abi_suggestion,
40 code = "{suggestion}",
41 applicability = "maybe-incorrect"
43 pub struct InvalidAbiSuggestion {
46 pub suggestion: String,
49 #[derive(Diagnostic, Clone, Copy)]
50 #[diag(ast_lowering_assoc_ty_parentheses)]
51 pub struct AssocTyParentheses {
55 pub sub: AssocTyParenthesesSub,
58 #[derive(Clone, Copy, Subdiagnostic)]
59 pub enum AssocTyParenthesesSub {
60 #[multipart_suggestion(ast_lowering_remove_parentheses)]
62 #[suggestion_part(code = "")]
63 parentheses_span: Span,
65 #[multipart_suggestion(ast_lowering_use_angle_brackets)]
67 #[suggestion_part(code = "<")]
69 #[suggestion_part(code = ">")]
75 #[diag(ast_lowering_misplaced_impl_trait, code = "E0562")]
76 pub struct MisplacedImplTrait<'a> {
79 pub position: DiagnosticArgFromDisplay<'a>,
82 #[derive(Diagnostic, Clone, Copy)]
83 #[diag(ast_lowering_rustc_box_attribute_error)]
84 pub struct RustcBoxAttributeError {
89 #[derive(Diagnostic, Clone, Copy)]
90 #[diag(ast_lowering_underscore_expr_lhs_assign)]
91 pub struct UnderscoreExprLhsAssign {
97 #[derive(Diagnostic, Clone, Copy)]
98 #[diag(ast_lowering_base_expression_double_dot)]
99 pub struct BaseExpressionDoubleDot {
105 #[derive(Diagnostic, Clone, Copy)]
106 #[diag(ast_lowering_await_only_in_async_fn_and_blocks, code = "E0728")]
107 pub struct AwaitOnlyInAsyncFnAndBlocks {
110 pub dot_await_span: Span,
111 #[label(ast_lowering_this_not_async)]
112 pub item_span: Option<Span>,
115 #[derive(Diagnostic, Clone, Copy)]
116 #[diag(ast_lowering_generator_too_many_parameters, code = "E0628")]
117 pub struct GeneratorTooManyParameters {
119 pub fn_decl_span: Span,
122 #[derive(Diagnostic, Clone, Copy)]
123 #[diag(ast_lowering_closure_cannot_be_static, code = "E0697")]
124 pub struct ClosureCannotBeStatic {
126 pub fn_decl_span: Span,
129 #[derive(Diagnostic, Clone, Copy)]
131 #[diag(ast_lowering_async_non_move_closure_not_supported, code = "E0708")]
132 pub struct AsyncNonMoveClosureNotSupported {
134 pub fn_decl_span: Span,
137 #[derive(Diagnostic, Clone, Copy)]
138 #[diag(ast_lowering_functional_record_update_destructuring_assignment)]
139 pub struct FunctionalRecordUpdateDestructuringAssignemnt {
141 #[suggestion(code = "", applicability = "machine-applicable")]
145 #[derive(Diagnostic, Clone, Copy)]
146 #[diag(ast_lowering_async_generators_not_supported, code = "E0727")]
147 pub struct AsyncGeneratorsNotSupported {
152 #[derive(Diagnostic, Clone, Copy)]
153 #[diag(ast_lowering_inline_asm_unsupported_target, code = "E0472")]
154 pub struct InlineAsmUnsupportedTarget {
159 #[derive(Diagnostic, Clone, Copy)]
160 #[diag(ast_lowering_att_syntax_only_x86)]
161 pub struct AttSyntaxOnlyX86 {
166 #[derive(Diagnostic, Clone, Copy)]
167 #[diag(ast_lowering_abi_specified_multiple_times)]
168 pub struct AbiSpecifiedMultipleTimes {
171 pub prev_name: Symbol,
175 pub equivalent: Option<()>,
178 #[derive(Diagnostic, Clone, Copy)]
179 #[diag(ast_lowering_clobber_abi_not_supported)]
180 pub struct ClobberAbiNotSupported {
185 #[derive(Diagnostic)]
187 #[diag(ast_lowering_invalid_abi_clobber_abi)]
188 pub struct InvalidAbiClobberAbi {
191 pub supported_abis: String,
194 #[derive(Diagnostic, Clone, Copy)]
195 #[diag(ast_lowering_invalid_register)]
196 pub struct InvalidRegister<'a> {
203 #[derive(Diagnostic, Clone, Copy)]
204 #[diag(ast_lowering_invalid_register_class)]
205 pub struct InvalidRegisterClass<'a> {
208 pub reg_class: Symbol,
212 #[derive(Diagnostic)]
213 #[diag(ast_lowering_invalid_asm_template_modifier_reg_class)]
214 pub struct InvalidAsmTemplateModifierRegClass {
216 #[label(ast_lowering_template_modifier)]
217 pub placeholder_span: Span,
218 #[label(ast_lowering_argument)]
221 pub sub: InvalidAsmTemplateModifierRegClassSub,
224 #[derive(Subdiagnostic)]
225 pub enum InvalidAsmTemplateModifierRegClassSub {
226 #[note(ast_lowering_support_modifiers)]
227 SupportModifier { class_name: Symbol, modifiers: String },
228 #[note(ast_lowering_does_not_support_modifiers)]
229 DoesNotSupportModifier { class_name: Symbol },
232 #[derive(Diagnostic, Clone, Copy)]
233 #[diag(ast_lowering_invalid_asm_template_modifier_const)]
234 pub struct InvalidAsmTemplateModifierConst {
236 #[label(ast_lowering_template_modifier)]
237 pub placeholder_span: Span,
238 #[label(ast_lowering_argument)]
242 #[derive(Diagnostic, Clone, Copy)]
243 #[diag(ast_lowering_invalid_asm_template_modifier_sym)]
244 pub struct InvalidAsmTemplateModifierSym {
246 #[label(ast_lowering_template_modifier)]
247 pub placeholder_span: Span,
248 #[label(ast_lowering_argument)]
252 #[derive(Diagnostic, Clone, Copy)]
253 #[diag(ast_lowering_register_class_only_clobber)]
254 pub struct RegisterClassOnlyClobber {
257 pub reg_class_name: Symbol,
260 #[derive(Diagnostic, Clone, Copy)]
261 #[diag(ast_lowering_register_conflict)]
262 pub struct RegisterConflict<'a> {
264 #[label(ast_lowering_register1)]
266 #[label(ast_lowering_register2)]
268 pub reg1_name: &'a str,
269 pub reg2_name: &'a str,
271 pub in_out: Option<Span>,
274 #[derive(Diagnostic, Clone, Copy)]
276 #[diag(ast_lowering_sub_tuple_binding)]
277 pub struct SubTupleBinding<'a> {
280 #[suggestion_verbose(
281 ast_lowering_sub_tuple_binding_suggestion,
283 applicability = "maybe-incorrect"
287 pub ident_name: Symbol,
291 #[derive(Diagnostic, Clone, Copy)]
292 #[diag(ast_lowering_extra_double_dot)]
293 pub struct ExtraDoubleDot<'a> {
297 #[label(ast_lowering_previously_used_here)]
302 #[derive(Diagnostic, Clone, Copy)]
304 #[diag(ast_lowering_misplaced_double_dot)]
305 pub struct MisplacedDoubleDot {
310 #[derive(Diagnostic, Clone, Copy)]
311 #[diag(ast_lowering_misplaced_relax_trait_bound)]
312 pub struct MisplacedRelaxTraitBound {
317 #[derive(Diagnostic, Clone, Copy)]
318 #[diag(ast_lowering_not_supported_for_lifetime_binder_async_closure)]
319 pub struct NotSupportedForLifetimeBinderAsyncClosure {
324 #[derive(Diagnostic, Clone, Copy)]
325 #[diag(ast_lowering_arbitrary_expression_in_pattern)]
326 pub struct ArbitraryExpressionInPattern {
331 #[derive(Diagnostic, Clone, Copy)]
332 #[diag(ast_lowering_inclusive_range_with_no_end)]
333 pub struct InclusiveRangeWithNoEnd {
338 #[derive(Diagnostic, Clone, Copy)]
339 #[diag(ast_lowering_trait_fn_async, code = "E0706")]
342 pub struct TraitFnAsync {