Migrate ast_lowering::expr to SessionDiagnostic

This commit is contained in:
Jean CASPAR
2022-08-17 19:48:25 +02:00
parent 0043d10c71
commit 1382d307d3
3 changed files with 125 additions and 80 deletions

View File

@@ -3,7 +3,7 @@ use rustc_macros::SessionDiagnostic;
use rustc_span::{Span, Symbol};
#[derive(SessionDiagnostic, Clone, Copy)]
#[error(ast_lowering::generic_type_with_parentheses, code = "E0214")]
#[diag(ast_lowering::generic_type_with_parentheses, code = "E0214")]
pub struct GenericTypeWithParentheses {
#[primary_span]
#[label]
@@ -30,7 +30,7 @@ impl AddSubdiagnostic for UseAngleBrackets {
#[derive(SessionDiagnostic)]
#[help]
#[error(ast_lowering::invalid_abi, code = "E0703")]
#[diag(ast_lowering::invalid_abi, code = "E0703")]
pub struct InvalidAbi {
#[primary_span]
#[label]
@@ -40,7 +40,7 @@ pub struct InvalidAbi {
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[error(ast_lowering::assoc_ty_parentheses)]
#[diag(ast_lowering::assoc_ty_parentheses)]
pub struct AssocTyParentheses {
#[primary_span]
pub span: Span,
@@ -72,9 +72,79 @@ impl AddSubdiagnostic for AssocTyParenthesesSub {
}
#[derive(SessionDiagnostic)]
#[error(ast_lowering::misplaced_impl_trait, code = "E0562")]
#[diag(ast_lowering::misplaced_impl_trait, code = "E0562")]
pub struct MisplacedImplTrait {
#[primary_span]
pub span: Span,
pub position: String,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::rustc_box_attribute_error)]
pub struct RustcBoxAttributeError {
#[primary_span]
pub span: Span,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::underscore_expr_lhs_assign)]
pub struct UnderscoreExprLhsAssign {
#[primary_span]
#[label]
pub span: Span,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::base_expression_double_dot)]
pub struct BaseExpressionDoubleDot {
#[primary_span]
#[label]
pub span: Span,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::await_only_in_async_fn_and_blocks, code = "E0728")]
pub struct AwaitOnlyInAsyncFnAndBlocks {
#[primary_span]
#[label]
pub dot_await_span: Span,
#[label(ast_lowering::this_not_async)]
pub item_span: Option<Span>,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::generator_too_many_parameters, code = "E0628")]
pub struct GeneratorTooManyParameters {
#[primary_span]
pub fn_decl_span: Span,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::closure_cannot_be_static, code = "E0697")]
pub struct ClosureCannotBeStatic {
#[primary_span]
pub fn_decl_span: Span,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[help]
#[diag(ast_lowering::async_non_move_closure_not_supported, code = "E0708")]
pub struct AsyncNonMoveClosureNotSupported {
#[primary_span]
pub fn_decl_span: Span,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::functional_record_update_destructuring_assignment)]
pub struct FunctionalRecordUpdateDestructuringAssignemnt {
#[primary_span]
#[suggestion(code = "", applicability = "machine-applicable")]
pub span: Span,
}
#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::async_generators_not_supported, code = "E0727")]
pub struct AsyncGeneratorsNotSupported {
#[primary_span]
pub span: Span,
}