1
Fork 0

Migrate all diagnostics

This commit is contained in:
Nilstrieb 2022-10-22 11:07:54 +02:00
parent 2459569776
commit c65ebae221
No known key found for this signature in database
58 changed files with 1279 additions and 1318 deletions

View file

@ -170,7 +170,7 @@ impl<'a> AstValidator<'a> {
DEPRECATED_WHERE_CLAUSE_LOCATION,
id,
where_clauses.0.1,
fluent::ast_passes::deprecated_where_clause_location,
fluent::ast_passes_deprecated_where_clause_location,
BuiltinLintDiagnostics::DeprecatedWhereclauseLocation(
where_clauses.1.1.shrink_to_hi(),
suggestion,
@ -1765,12 +1765,12 @@ pub(crate) enum ForbiddenLetReason {
/// `let` is not valid and the source environment is not important
GenericForbidden,
/// A let chain with the `||` operator
#[note(ast_passes::not_supported_or)]
#[note(not_supported_or)]
NotSupportedOr(#[primary_span] Span),
/// A let chain with invalid parentheses
///
/// For example, `let 1 = 1 && (expr && expr)` is allowed
/// but `(let 1 = 1 && (let 1 = 1 && (let 1 = 1))) && let a = 1` is not
#[note(ast_passes::not_supported_parentheses)]
#[note(not_supported_parentheses)]
NotSupportedParentheses(#[primary_span] Span),
}

View file

@ -7,7 +7,7 @@ use rustc_span::{Span, Symbol};
use crate::ast_validation::ForbiddenLetReason;
#[derive(Diagnostic)]
#[diag(ast_passes::forbidden_let)]
#[diag(ast_passes_forbidden_let)]
#[note]
pub struct ForbiddenLet {
#[primary_span]
@ -17,7 +17,7 @@ pub struct ForbiddenLet {
}
#[derive(Diagnostic)]
#[diag(ast_passes::forbidden_let_stable)]
#[diag(ast_passes_forbidden_let_stable)]
#[note]
pub struct ForbiddenLetStable {
#[primary_span]
@ -25,21 +25,21 @@ pub struct ForbiddenLetStable {
}
#[derive(Diagnostic)]
#[diag(ast_passes::forbidden_assoc_constraint)]
#[diag(ast_passes_forbidden_assoc_constraint)]
pub struct ForbiddenAssocConstraint {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_passes::keyword_lifetime)]
#[diag(ast_passes_keyword_lifetime)]
pub struct KeywordLifetime {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_passes::invalid_label)]
#[diag(ast_passes_invalid_label)]
pub struct InvalidLabel {
#[primary_span]
pub span: Span,
@ -47,11 +47,11 @@ pub struct InvalidLabel {
}
#[derive(Diagnostic)]
#[diag(ast_passes::invalid_visibility, code = "E0449")]
#[diag(ast_passes_invalid_visibility, code = "E0449")]
pub struct InvalidVisibility {
#[primary_span]
pub span: Span,
#[label(ast_passes::implied)]
#[label(implied)]
pub implied: Option<Span>,
#[subdiagnostic]
pub note: Option<InvalidVisibilityNote>,
@ -59,14 +59,14 @@ pub struct InvalidVisibility {
#[derive(Subdiagnostic)]
pub enum InvalidVisibilityNote {
#[note(ast_passes::individual_impl_items)]
#[note(individual_impl_items)]
IndividualImplItems,
#[note(ast_passes::individual_foreign_items)]
#[note(individual_foreign_items)]
IndividualForeignItems,
}
#[derive(Diagnostic)]
#[diag(ast_passes::trait_fn_const, code = "E0379")]
#[diag(ast_passes_trait_fn_const, code = "E0379")]
pub struct TraitFnConst {
#[primary_span]
#[label]
@ -74,21 +74,21 @@ pub struct TraitFnConst {
}
#[derive(Diagnostic)]
#[diag(ast_passes::forbidden_lifetime_bound)]
#[diag(ast_passes_forbidden_lifetime_bound)]
pub struct ForbiddenLifetimeBound {
#[primary_span]
pub spans: Vec<Span>,
}
#[derive(Diagnostic)]
#[diag(ast_passes::forbidden_non_lifetime_param)]
#[diag(ast_passes_forbidden_non_lifetime_param)]
pub struct ForbiddenNonLifetimeParam {
#[primary_span]
pub spans: Vec<Span>,
}
#[derive(Diagnostic)]
#[diag(ast_passes::fn_param_too_many)]
#[diag(ast_passes_fn_param_too_many)]
pub struct FnParamTooMany {
#[primary_span]
pub span: Span,
@ -96,21 +96,21 @@ pub struct FnParamTooMany {
}
#[derive(Diagnostic)]
#[diag(ast_passes::fn_param_c_var_args_only)]
#[diag(ast_passes_fn_param_c_var_args_only)]
pub struct FnParamCVarArgsOnly {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_passes::fn_param_c_var_args_not_last)]
#[diag(ast_passes_fn_param_c_var_args_not_last)]
pub struct FnParamCVarArgsNotLast {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_passes::fn_param_doc_comment)]
#[diag(ast_passes_fn_param_doc_comment)]
pub struct FnParamDocComment {
#[primary_span]
#[label]
@ -118,14 +118,14 @@ pub struct FnParamDocComment {
}
#[derive(Diagnostic)]
#[diag(ast_passes::fn_param_forbidden_attr)]
#[diag(ast_passes_fn_param_forbidden_attr)]
pub struct FnParamForbiddenAttr {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ast_passes::fn_param_forbidden_self)]
#[diag(ast_passes_fn_param_forbidden_self)]
#[note]
pub struct FnParamForbiddenSelf {
#[primary_span]
@ -134,7 +134,7 @@ pub struct FnParamForbiddenSelf {
}
#[derive(Diagnostic)]
#[diag(ast_passes::forbidden_default)]
#[diag(ast_passes_forbidden_default)]
pub struct ForbiddenDefault {
#[primary_span]
pub span: Span,
@ -143,7 +143,7 @@ pub struct ForbiddenDefault {
}
#[derive(Diagnostic)]
#[diag(ast_passes::assoc_const_without_body)]
#[diag(ast_passes_assoc_const_without_body)]
pub struct AssocConstWithoutBody {
#[primary_span]
pub span: Span,
@ -152,7 +152,7 @@ pub struct AssocConstWithoutBody {
}
#[derive(Diagnostic)]
#[diag(ast_passes::assoc_fn_without_body)]
#[diag(ast_passes_assoc_fn_without_body)]
pub struct AssocFnWithoutBody {
#[primary_span]
pub span: Span,
@ -161,7 +161,7 @@ pub struct AssocFnWithoutBody {
}
#[derive(Diagnostic)]
#[diag(ast_passes::assoc_type_without_body)]
#[diag(ast_passes_assoc_type_without_body)]
pub struct AssocTypeWithoutBody {
#[primary_span]
pub span: Span,
@ -170,7 +170,7 @@ pub struct AssocTypeWithoutBody {
}
#[derive(Diagnostic)]
#[diag(ast_passes::const_without_body)]
#[diag(ast_passes_const_without_body)]
pub struct ConstWithoutBody {
#[primary_span]
pub span: Span,
@ -179,7 +179,7 @@ pub struct ConstWithoutBody {
}
#[derive(Diagnostic)]
#[diag(ast_passes::static_without_body)]
#[diag(ast_passes_static_without_body)]
pub struct StaticWithoutBody {
#[primary_span]
pub span: Span,
@ -188,7 +188,7 @@ pub struct StaticWithoutBody {
}
#[derive(Diagnostic)]
#[diag(ast_passes::ty_alias_without_body)]
#[diag(ast_passes_ty_alias_without_body)]
pub struct TyAliasWithoutBody {
#[primary_span]
pub span: Span,
@ -197,7 +197,7 @@ pub struct TyAliasWithoutBody {
}
#[derive(Diagnostic)]
#[diag(ast_passes::fn_without_body)]
#[diag(ast_passes_fn_without_body)]
pub struct FnWithoutBody {
#[primary_span]
pub span: Span,
@ -226,7 +226,7 @@ impl AddToDiagnostic for ExternBlockSuggestion {
let end_suggestion = " }".to_owned();
diag.multipart_suggestion(
fluent::ast_passes::extern_block_suggestion,
fluent::extern_block_suggestion,
vec![(self.start_span, start_suggestion), (self.end_span, end_suggestion)],
Applicability::MaybeIncorrect,
);