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

@ -3,7 +3,7 @@ use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::{symbol::Ident, Span, Symbol}; use rustc_span::{symbol::Ident, Span, Symbol};
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::generic_type_with_parentheses, code = "E0214")] #[diag(ast_lowering_generic_type_with_parentheses, code = "E0214")]
pub struct GenericTypeWithParentheses { pub struct GenericTypeWithParentheses {
#[primary_span] #[primary_span]
#[label] #[label]
@ -13,7 +13,7 @@ pub struct GenericTypeWithParentheses {
} }
#[derive(Clone, Copy, Subdiagnostic)] #[derive(Clone, Copy, Subdiagnostic)]
#[multipart_suggestion(ast_lowering::use_angle_brackets, applicability = "maybe-incorrect")] #[multipart_suggestion(ast_lowering_use_angle_brackets, applicability = "maybe-incorrect")]
pub struct UseAngleBrackets { pub struct UseAngleBrackets {
#[suggestion_part(code = "<")] #[suggestion_part(code = "<")]
pub open_param: Span, pub open_param: Span,
@ -22,7 +22,7 @@ pub struct UseAngleBrackets {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_lowering::invalid_abi, code = "E0703")] #[diag(ast_lowering_invalid_abi, code = "E0703")]
#[note] #[note]
pub struct InvalidAbi { pub struct InvalidAbi {
#[primary_span] #[primary_span]
@ -36,7 +36,7 @@ pub struct InvalidAbi {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[suggestion( #[suggestion(
ast_lowering::invalid_abi_suggestion, ast_lowering_invalid_abi_suggestion,
code = "{suggestion}", code = "{suggestion}",
applicability = "maybe-incorrect" applicability = "maybe-incorrect"
)] )]
@ -47,7 +47,7 @@ pub struct InvalidAbiSuggestion {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::assoc_ty_parentheses)] #[diag(ast_lowering_assoc_ty_parentheses)]
pub struct AssocTyParentheses { pub struct AssocTyParentheses {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -57,12 +57,12 @@ pub struct AssocTyParentheses {
#[derive(Clone, Copy, Subdiagnostic)] #[derive(Clone, Copy, Subdiagnostic)]
pub enum AssocTyParenthesesSub { pub enum AssocTyParenthesesSub {
#[multipart_suggestion(ast_lowering::remove_parentheses)] #[multipart_suggestion(ast_lowering_remove_parentheses)]
Empty { Empty {
#[suggestion_part(code = "")] #[suggestion_part(code = "")]
parentheses_span: Span, parentheses_span: Span,
}, },
#[multipart_suggestion(ast_lowering::use_angle_brackets)] #[multipart_suggestion(ast_lowering_use_angle_brackets)]
NotEmpty { NotEmpty {
#[suggestion_part(code = "<")] #[suggestion_part(code = "<")]
open_param: Span, open_param: Span,
@ -72,7 +72,7 @@ pub enum AssocTyParenthesesSub {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_lowering::misplaced_impl_trait, code = "E0562")] #[diag(ast_lowering_misplaced_impl_trait, code = "E0562")]
pub struct MisplacedImplTrait<'a> { pub struct MisplacedImplTrait<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -80,14 +80,14 @@ pub struct MisplacedImplTrait<'a> {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::rustc_box_attribute_error)] #[diag(ast_lowering_rustc_box_attribute_error)]
pub struct RustcBoxAttributeError { pub struct RustcBoxAttributeError {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::underscore_expr_lhs_assign)] #[diag(ast_lowering_underscore_expr_lhs_assign)]
pub struct UnderscoreExprLhsAssign { pub struct UnderscoreExprLhsAssign {
#[primary_span] #[primary_span]
#[label] #[label]
@ -95,7 +95,7 @@ pub struct UnderscoreExprLhsAssign {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::base_expression_double_dot)] #[diag(ast_lowering_base_expression_double_dot)]
pub struct BaseExpressionDoubleDot { pub struct BaseExpressionDoubleDot {
#[primary_span] #[primary_span]
#[label] #[label]
@ -103,24 +103,24 @@ pub struct BaseExpressionDoubleDot {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::await_only_in_async_fn_and_blocks, code = "E0728")] #[diag(ast_lowering_await_only_in_async_fn_and_blocks, code = "E0728")]
pub struct AwaitOnlyInAsyncFnAndBlocks { pub struct AwaitOnlyInAsyncFnAndBlocks {
#[primary_span] #[primary_span]
#[label] #[label]
pub dot_await_span: Span, pub dot_await_span: Span,
#[label(ast_lowering::this_not_async)] #[label(ast_lowering_this_not_async)]
pub item_span: Option<Span>, pub item_span: Option<Span>,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::generator_too_many_parameters, code = "E0628")] #[diag(ast_lowering_generator_too_many_parameters, code = "E0628")]
pub struct GeneratorTooManyParameters { pub struct GeneratorTooManyParameters {
#[primary_span] #[primary_span]
pub fn_decl_span: Span, pub fn_decl_span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::closure_cannot_be_static, code = "E0697")] #[diag(ast_lowering_closure_cannot_be_static, code = "E0697")]
pub struct ClosureCannotBeStatic { pub struct ClosureCannotBeStatic {
#[primary_span] #[primary_span]
pub fn_decl_span: Span, pub fn_decl_span: Span,
@ -128,14 +128,14 @@ pub struct ClosureCannotBeStatic {
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[help] #[help]
#[diag(ast_lowering::async_non_move_closure_not_supported, code = "E0708")] #[diag(ast_lowering_async_non_move_closure_not_supported, code = "E0708")]
pub struct AsyncNonMoveClosureNotSupported { pub struct AsyncNonMoveClosureNotSupported {
#[primary_span] #[primary_span]
pub fn_decl_span: Span, pub fn_decl_span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::functional_record_update_destructuring_assignment)] #[diag(ast_lowering_functional_record_update_destructuring_assignment)]
pub struct FunctionalRecordUpdateDestructuringAssignemnt { pub struct FunctionalRecordUpdateDestructuringAssignemnt {
#[primary_span] #[primary_span]
#[suggestion(code = "", applicability = "machine-applicable")] #[suggestion(code = "", applicability = "machine-applicable")]
@ -143,28 +143,28 @@ pub struct FunctionalRecordUpdateDestructuringAssignemnt {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::async_generators_not_supported, code = "E0727")] #[diag(ast_lowering_async_generators_not_supported, code = "E0727")]
pub struct AsyncGeneratorsNotSupported { pub struct AsyncGeneratorsNotSupported {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::inline_asm_unsupported_target, code = "E0472")] #[diag(ast_lowering_inline_asm_unsupported_target, code = "E0472")]
pub struct InlineAsmUnsupportedTarget { pub struct InlineAsmUnsupportedTarget {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::att_syntax_only_x86)] #[diag(ast_lowering_att_syntax_only_x86)]
pub struct AttSyntaxOnlyX86 { pub struct AttSyntaxOnlyX86 {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::abi_specified_multiple_times)] #[diag(ast_lowering_abi_specified_multiple_times)]
pub struct AbiSpecifiedMultipleTimes { pub struct AbiSpecifiedMultipleTimes {
#[primary_span] #[primary_span]
pub abi_span: Span, pub abi_span: Span,
@ -176,7 +176,7 @@ pub struct AbiSpecifiedMultipleTimes {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::clobber_abi_not_supported)] #[diag(ast_lowering_clobber_abi_not_supported)]
pub struct ClobberAbiNotSupported { pub struct ClobberAbiNotSupported {
#[primary_span] #[primary_span]
pub abi_span: Span, pub abi_span: Span,
@ -184,7 +184,7 @@ pub struct ClobberAbiNotSupported {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[note] #[note]
#[diag(ast_lowering::invalid_abi_clobber_abi)] #[diag(ast_lowering_invalid_abi_clobber_abi)]
pub struct InvalidAbiClobberAbi { pub struct InvalidAbiClobberAbi {
#[primary_span] #[primary_span]
pub abi_span: Span, pub abi_span: Span,
@ -192,7 +192,7 @@ pub struct InvalidAbiClobberAbi {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::invalid_register)] #[diag(ast_lowering_invalid_register)]
pub struct InvalidRegister<'a> { pub struct InvalidRegister<'a> {
#[primary_span] #[primary_span]
pub op_span: Span, pub op_span: Span,
@ -201,7 +201,7 @@ pub struct InvalidRegister<'a> {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::invalid_register_class)] #[diag(ast_lowering_invalid_register_class)]
pub struct InvalidRegisterClass<'a> { pub struct InvalidRegisterClass<'a> {
#[primary_span] #[primary_span]
pub op_span: Span, pub op_span: Span,
@ -210,12 +210,12 @@ pub struct InvalidRegisterClass<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ast_lowering::invalid_asm_template_modifier_reg_class)] #[diag(ast_lowering_invalid_asm_template_modifier_reg_class)]
pub struct InvalidAsmTemplateModifierRegClass { pub struct InvalidAsmTemplateModifierRegClass {
#[primary_span] #[primary_span]
#[label(ast_lowering::template_modifier)] #[label(ast_lowering_template_modifier)]
pub placeholder_span: Span, pub placeholder_span: Span,
#[label(ast_lowering::argument)] #[label(ast_lowering_argument)]
pub op_span: Span, pub op_span: Span,
#[subdiagnostic] #[subdiagnostic]
pub sub: InvalidAsmTemplateModifierRegClassSub, pub sub: InvalidAsmTemplateModifierRegClassSub,
@ -223,34 +223,34 @@ pub struct InvalidAsmTemplateModifierRegClass {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum InvalidAsmTemplateModifierRegClassSub { pub enum InvalidAsmTemplateModifierRegClassSub {
#[note(ast_lowering::support_modifiers)] #[note(ast_lowering_support_modifiers)]
SupportModifier { class_name: Symbol, modifiers: String }, SupportModifier { class_name: Symbol, modifiers: String },
#[note(ast_lowering::does_not_support_modifiers)] #[note(ast_lowering_does_not_support_modifiers)]
DoesNotSupportModifier { class_name: Symbol }, DoesNotSupportModifier { class_name: Symbol },
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::invalid_asm_template_modifier_const)] #[diag(ast_lowering_invalid_asm_template_modifier_const)]
pub struct InvalidAsmTemplateModifierConst { pub struct InvalidAsmTemplateModifierConst {
#[primary_span] #[primary_span]
#[label(ast_lowering::template_modifier)] #[label(ast_lowering_template_modifier)]
pub placeholder_span: Span, pub placeholder_span: Span,
#[label(ast_lowering::argument)] #[label(ast_lowering_argument)]
pub op_span: Span, pub op_span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::invalid_asm_template_modifier_sym)] #[diag(ast_lowering_invalid_asm_template_modifier_sym)]
pub struct InvalidAsmTemplateModifierSym { pub struct InvalidAsmTemplateModifierSym {
#[primary_span] #[primary_span]
#[label(ast_lowering::template_modifier)] #[label(ast_lowering_template_modifier)]
pub placeholder_span: Span, pub placeholder_span: Span,
#[label(ast_lowering::argument)] #[label(ast_lowering_argument)]
pub op_span: Span, pub op_span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::register_class_only_clobber)] #[diag(ast_lowering_register_class_only_clobber)]
pub struct RegisterClassOnlyClobber { pub struct RegisterClassOnlyClobber {
#[primary_span] #[primary_span]
pub op_span: Span, pub op_span: Span,
@ -258,12 +258,12 @@ pub struct RegisterClassOnlyClobber {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::register_conflict)] #[diag(ast_lowering_register_conflict)]
pub struct RegisterConflict<'a> { pub struct RegisterConflict<'a> {
#[primary_span] #[primary_span]
#[label(ast_lowering::register1)] #[label(ast_lowering_register1)]
pub op_span1: Span, pub op_span1: Span,
#[label(ast_lowering::register2)] #[label(ast_lowering_register2)]
pub op_span2: Span, pub op_span2: Span,
pub reg1_name: &'a str, pub reg1_name: &'a str,
pub reg2_name: &'a str, pub reg2_name: &'a str,
@ -273,12 +273,12 @@ pub struct RegisterConflict<'a> {
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[help] #[help]
#[diag(ast_lowering::sub_tuple_binding)] #[diag(ast_lowering_sub_tuple_binding)]
pub struct SubTupleBinding<'a> { pub struct SubTupleBinding<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
#[suggestion_verbose( #[suggestion_verbose(
ast_lowering::sub_tuple_binding_suggestion, ast_lowering_sub_tuple_binding_suggestion,
code = "..", code = "..",
applicability = "maybe-incorrect" applicability = "maybe-incorrect"
)] )]
@ -289,56 +289,56 @@ pub struct SubTupleBinding<'a> {
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::extra_double_dot)] #[diag(ast_lowering_extra_double_dot)]
pub struct ExtraDoubleDot<'a> { pub struct ExtraDoubleDot<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
#[label(ast_lowering::previously_used_here)] #[label(ast_lowering_previously_used_here)]
pub prev_span: Span, pub prev_span: Span,
pub ctx: &'a str, pub ctx: &'a str,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[note] #[note]
#[diag(ast_lowering::misplaced_double_dot)] #[diag(ast_lowering_misplaced_double_dot)]
pub struct MisplacedDoubleDot { pub struct MisplacedDoubleDot {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::misplaced_relax_trait_bound)] #[diag(ast_lowering_misplaced_relax_trait_bound)]
pub struct MisplacedRelaxTraitBound { pub struct MisplacedRelaxTraitBound {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::not_supported_for_lifetime_binder_async_closure)] #[diag(ast_lowering_not_supported_for_lifetime_binder_async_closure)]
pub struct NotSupportedForLifetimeBinderAsyncClosure { pub struct NotSupportedForLifetimeBinderAsyncClosure {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::arbitrary_expression_in_pattern)] #[diag(ast_lowering_arbitrary_expression_in_pattern)]
pub struct ArbitraryExpressionInPattern { pub struct ArbitraryExpressionInPattern {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::inclusive_range_with_no_end)] #[diag(ast_lowering_inclusive_range_with_no_end)]
pub struct InclusiveRangeWithNoEnd { pub struct InclusiveRangeWithNoEnd {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic, Clone, Copy)] #[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering::trait_fn_async, code = "E0706")] #[diag(ast_lowering_trait_fn_async, code = "E0706")]
#[note] #[note]
#[note(ast_lowering::note2)] #[note(note2)]
pub struct TraitFnAsync { pub struct TraitFnAsync {
#[primary_span] #[primary_span]
pub fn_span: Span, pub fn_span: Span,

View File

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

View File

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

View File

@ -10,14 +10,14 @@ use rustc_span::{Span, Symbol};
use crate::UnsupportedLiteralReason; use crate::UnsupportedLiteralReason;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::expected_one_cfg_pattern, code = "E0536")] #[diag(attr_expected_one_cfg_pattern, code = "E0536")]
pub(crate) struct ExpectedOneCfgPattern { pub(crate) struct ExpectedOneCfgPattern {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::invalid_predicate, code = "E0537")] #[diag(attr_invalid_predicate, code = "E0537")]
pub(crate) struct InvalidPredicate { pub(crate) struct InvalidPredicate {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -26,7 +26,7 @@ pub(crate) struct InvalidPredicate {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::multiple_item, code = "E0538")] #[diag(attr_multiple_item, code = "E0538")]
pub(crate) struct MultipleItem { pub(crate) struct MultipleItem {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -35,7 +35,7 @@ pub(crate) struct MultipleItem {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::incorrect_meta_item, code = "E0539")] #[diag(attr_incorrect_meta_item, code = "E0539")]
pub(crate) struct IncorrectMetaItem { pub(crate) struct IncorrectMetaItem {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -54,39 +54,39 @@ impl<'a> IntoDiagnostic<'a> for UnknownMetaItem<'_> {
let expected = self.expected.iter().map(|name| format!("`{}`", name)).collect::<Vec<_>>(); let expected = self.expected.iter().map(|name| format!("`{}`", name)).collect::<Vec<_>>();
let mut diag = handler.struct_span_err_with_code( let mut diag = handler.struct_span_err_with_code(
self.span, self.span,
fluent::attr::unknown_meta_item, fluent::attr_unknown_meta_item,
error_code!(E0541), error_code!(E0541),
); );
diag.set_arg("item", self.item); diag.set_arg("item", self.item);
diag.set_arg("expected", expected.join(", ")); diag.set_arg("expected", expected.join(", "));
diag.span_label(self.span, fluent::attr::label); diag.span_label(self.span, fluent::label);
diag diag
} }
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::missing_since, code = "E0542")] #[diag(attr_missing_since, code = "E0542")]
pub(crate) struct MissingSince { pub(crate) struct MissingSince {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::missing_note, code = "E0543")] #[diag(attr_missing_note, code = "E0543")]
pub(crate) struct MissingNote { pub(crate) struct MissingNote {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::multiple_stability_levels, code = "E0544")] #[diag(attr_multiple_stability_levels, code = "E0544")]
pub(crate) struct MultipleStabilityLevels { pub(crate) struct MultipleStabilityLevels {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::invalid_issue_string, code = "E0545")] #[diag(attr_invalid_issue_string, code = "E0545")]
pub(crate) struct InvalidIssueString { pub(crate) struct InvalidIssueString {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -99,31 +99,31 @@ pub(crate) struct InvalidIssueString {
// translatable. // translatable.
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub(crate) enum InvalidIssueStringCause { pub(crate) enum InvalidIssueStringCause {
#[label(attr::must_not_be_zero)] #[label(must_not_be_zero)]
MustNotBeZero { MustNotBeZero {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(attr::empty)] #[label(empty)]
Empty { Empty {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(attr::invalid_digit)] #[label(invalid_digit)]
InvalidDigit { InvalidDigit {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(attr::pos_overflow)] #[label(pos_overflow)]
PosOverflow { PosOverflow {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(attr::neg_overflow)] #[label(neg_overflow)]
NegOverflow { NegOverflow {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -144,21 +144,21 @@ impl InvalidIssueStringCause {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::missing_feature, code = "E0546")] #[diag(attr_missing_feature, code = "E0546")]
pub(crate) struct MissingFeature { pub(crate) struct MissingFeature {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::non_ident_feature, code = "E0546")] #[diag(attr_non_ident_feature, code = "E0546")]
pub(crate) struct NonIdentFeature { pub(crate) struct NonIdentFeature {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::missing_issue, code = "E0547")] #[diag(attr_missing_issue, code = "E0547")]
pub(crate) struct MissingIssue { pub(crate) struct MissingIssue {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -167,7 +167,7 @@ pub(crate) struct MissingIssue {
// FIXME: This diagnostic is identical to `IncorrectMetaItem`, barring the error code. Consider // FIXME: This diagnostic is identical to `IncorrectMetaItem`, barring the error code. Consider
// changing this to `IncorrectMetaItem`. See #51489. // changing this to `IncorrectMetaItem`. See #51489.
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::incorrect_meta_item, code = "E0551")] #[diag(attr_incorrect_meta_item, code = "E0551")]
pub(crate) struct IncorrectMetaItem2 { pub(crate) struct IncorrectMetaItem2 {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -176,14 +176,14 @@ pub(crate) struct IncorrectMetaItem2 {
// FIXME: Why is this the same error code as `InvalidReprHintNoParen` and `InvalidReprHintNoValue`? // FIXME: Why is this the same error code as `InvalidReprHintNoParen` and `InvalidReprHintNoValue`?
// It is more similar to `IncorrectReprFormatGeneric`. // It is more similar to `IncorrectReprFormatGeneric`.
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::incorrect_repr_format_packed_one_or_zero_arg, code = "E0552")] #[diag(attr_incorrect_repr_format_packed_one_or_zero_arg, code = "E0552")]
pub(crate) struct IncorrectReprFormatPackedOneOrZeroArg { pub(crate) struct IncorrectReprFormatPackedOneOrZeroArg {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::invalid_repr_hint_no_paren, code = "E0552")] #[diag(attr_invalid_repr_hint_no_paren, code = "E0552")]
pub(crate) struct InvalidReprHintNoParen { pub(crate) struct InvalidReprHintNoParen {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -192,7 +192,7 @@ pub(crate) struct InvalidReprHintNoParen {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::invalid_repr_hint_no_value, code = "E0552")] #[diag(attr_invalid_repr_hint_no_value, code = "E0552")]
pub(crate) struct InvalidReprHintNoValue { pub(crate) struct InvalidReprHintNoValue {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -213,13 +213,13 @@ impl<'a> IntoDiagnostic<'a> for UnsupportedLiteral {
let mut diag = handler.struct_span_err_with_code( let mut diag = handler.struct_span_err_with_code(
self.span, self.span,
match self.reason { match self.reason {
UnsupportedLiteralReason::Generic => fluent::attr::unsupported_literal_generic, UnsupportedLiteralReason::Generic => fluent::attr_unsupported_literal_generic,
UnsupportedLiteralReason::CfgString => fluent::attr::unsupported_literal_cfg_string, UnsupportedLiteralReason::CfgString => fluent::attr_unsupported_literal_cfg_string,
UnsupportedLiteralReason::DeprecatedString => { UnsupportedLiteralReason::DeprecatedString => {
fluent::attr::unsupported_literal_deprecated_string fluent::attr_unsupported_literal_deprecated_string
} }
UnsupportedLiteralReason::DeprecatedKvPair => { UnsupportedLiteralReason::DeprecatedKvPair => {
fluent::attr::unsupported_literal_deprecated_kv_pair fluent::attr_unsupported_literal_deprecated_kv_pair
} }
}, },
error_code!(E0565), error_code!(E0565),
@ -227,7 +227,7 @@ impl<'a> IntoDiagnostic<'a> for UnsupportedLiteral {
if self.is_bytestr { if self.is_bytestr {
diag.span_suggestion( diag.span_suggestion(
self.start_point_span, self.start_point_span,
fluent::attr::unsupported_literal_suggestion, fluent::attr_unsupported_literal_suggestion,
"", "",
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
@ -237,7 +237,7 @@ impl<'a> IntoDiagnostic<'a> for UnsupportedLiteral {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::invalid_repr_align_need_arg, code = "E0589")] #[diag(attr_invalid_repr_align_need_arg, code = "E0589")]
pub(crate) struct InvalidReprAlignNeedArg { pub(crate) struct InvalidReprAlignNeedArg {
#[primary_span] #[primary_span]
#[suggestion(code = "align(...)", applicability = "has-placeholders")] #[suggestion(code = "align(...)", applicability = "has-placeholders")]
@ -245,7 +245,7 @@ pub(crate) struct InvalidReprAlignNeedArg {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::invalid_repr_generic, code = "E0589")] #[diag(attr_invalid_repr_generic, code = "E0589")]
pub(crate) struct InvalidReprGeneric<'a> { pub(crate) struct InvalidReprGeneric<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -255,14 +255,14 @@ pub(crate) struct InvalidReprGeneric<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::incorrect_repr_format_align_one_arg, code = "E0693")] #[diag(attr_incorrect_repr_format_align_one_arg, code = "E0693")]
pub(crate) struct IncorrectReprFormatAlignOneArg { pub(crate) struct IncorrectReprFormatAlignOneArg {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::incorrect_repr_format_generic, code = "E0693")] #[diag(attr_incorrect_repr_format_generic, code = "E0693")]
pub(crate) struct IncorrectReprFormatGeneric<'a> { pub(crate) struct IncorrectReprFormatGeneric<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -275,7 +275,7 @@ pub(crate) struct IncorrectReprFormatGeneric<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub(crate) enum IncorrectReprFormatGenericCause<'a> { pub(crate) enum IncorrectReprFormatGenericCause<'a> {
#[suggestion(attr::suggestion, code = "{name}({int})", applicability = "machine-applicable")] #[suggestion(suggestion, code = "{name}({int})", applicability = "machine-applicable")]
Int { Int {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -287,11 +287,7 @@ pub(crate) enum IncorrectReprFormatGenericCause<'a> {
int: u128, int: u128,
}, },
#[suggestion( #[suggestion(suggestion, code = "{name}({symbol})", applicability = "machine-applicable")]
attr::suggestion,
code = "{name}({symbol})",
applicability = "machine-applicable"
)]
Symbol { Symbol {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -317,28 +313,28 @@ impl<'a> IncorrectReprFormatGenericCause<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::rustc_promotable_pairing, code = "E0717")] #[diag(attr_rustc_promotable_pairing, code = "E0717")]
pub(crate) struct RustcPromotablePairing { pub(crate) struct RustcPromotablePairing {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::rustc_allowed_unstable_pairing, code = "E0789")] #[diag(attr_rustc_allowed_unstable_pairing, code = "E0789")]
pub(crate) struct RustcAllowedUnstablePairing { pub(crate) struct RustcAllowedUnstablePairing {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::cfg_predicate_identifier)] #[diag(attr_cfg_predicate_identifier)]
pub(crate) struct CfgPredicateIdentifier { pub(crate) struct CfgPredicateIdentifier {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::deprecated_item_suggestion)] #[diag(attr_deprecated_item_suggestion)]
pub(crate) struct DeprecatedItemSuggestion { pub(crate) struct DeprecatedItemSuggestion {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -351,21 +347,21 @@ pub(crate) struct DeprecatedItemSuggestion {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::expected_single_version_literal)] #[diag(attr_expected_single_version_literal)]
pub(crate) struct ExpectedSingleVersionLiteral { pub(crate) struct ExpectedSingleVersionLiteral {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::expected_version_literal)] #[diag(attr_expected_version_literal)]
pub(crate) struct ExpectedVersionLiteral { pub(crate) struct ExpectedVersionLiteral {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::expects_feature_list)] #[diag(attr_expects_feature_list)]
pub(crate) struct ExpectsFeatureList { pub(crate) struct ExpectsFeatureList {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -374,7 +370,7 @@ pub(crate) struct ExpectsFeatureList {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::expects_features)] #[diag(attr_expects_features)]
pub(crate) struct ExpectsFeatures { pub(crate) struct ExpectsFeatures {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -383,14 +379,14 @@ pub(crate) struct ExpectsFeatures {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::soft_no_args)] #[diag(attr_soft_no_args)]
pub(crate) struct SoftNoArgs { pub(crate) struct SoftNoArgs {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(attr::unknown_version_literal)] #[diag(attr_unknown_version_literal)]
pub(crate) struct UnknownVersionLiteral { pub(crate) struct UnknownVersionLiteral {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,

View File

@ -6,7 +6,7 @@ use rustc_span::Span;
use crate::diagnostics::RegionName; use crate::diagnostics::RegionName;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(borrowck::move_unsized, code = "E0161")] #[diag(borrowck_move_unsized, code = "E0161")]
pub(crate) struct MoveUnsized<'tcx> { pub(crate) struct MoveUnsized<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
#[primary_span] #[primary_span]
@ -15,7 +15,7 @@ pub(crate) struct MoveUnsized<'tcx> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(borrowck::higher_ranked_lifetime_error)] #[diag(borrowck_higher_ranked_lifetime_error)]
pub(crate) struct HigherRankedLifetimeError { pub(crate) struct HigherRankedLifetimeError {
#[subdiagnostic] #[subdiagnostic]
pub cause: Option<HigherRankedErrorCause>, pub cause: Option<HigherRankedErrorCause>,
@ -25,21 +25,21 @@ pub(crate) struct HigherRankedLifetimeError {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub(crate) enum HigherRankedErrorCause { pub(crate) enum HigherRankedErrorCause {
#[note(borrowck::could_not_prove)] #[note(borrowck_could_not_prove)]
CouldNotProve { predicate: String }, CouldNotProve { predicate: String },
#[note(borrowck::could_not_normalize)] #[note(borrowck_could_not_normalize)]
CouldNotNormalize { value: String }, CouldNotNormalize { value: String },
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(borrowck::higher_ranked_subtype_error)] #[diag(borrowck_higher_ranked_subtype_error)]
pub(crate) struct HigherRankedSubtypeError { pub(crate) struct HigherRankedSubtypeError {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(borrowck::generic_does_not_live_long_enough)] #[diag(borrowck_generic_does_not_live_long_enough)]
pub(crate) struct GenericDoesNotLiveLongEnough { pub(crate) struct GenericDoesNotLiveLongEnough {
pub kind: String, pub kind: String,
#[primary_span] #[primary_span]
@ -47,15 +47,15 @@ pub(crate) struct GenericDoesNotLiveLongEnough {
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(borrowck::var_does_not_need_mut)] #[diag(borrowck_var_does_not_need_mut)]
pub(crate) struct VarNeedNotMut { pub(crate) struct VarNeedNotMut {
#[suggestion_short(applicability = "machine-applicable", code = "")] #[suggestion_short(applicability = "machine-applicable", code = "")]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(borrowck::var_cannot_escape_closure)] #[diag(borrowck_var_cannot_escape_closure)]
#[note] #[note]
#[note(borrowck::cannot_escape)] #[note(cannot_escape)]
pub(crate) struct FnMutError { pub(crate) struct FnMutError {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -65,17 +65,17 @@ pub(crate) struct FnMutError {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub(crate) enum VarHereDenote { pub(crate) enum VarHereDenote {
#[label(borrowck::var_here_captured)] #[label(borrowck_var_here_captured)]
Captured { Captured {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(borrowck::var_here_defined)] #[label(borrowck_var_here_defined)]
Defined { Defined {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(borrowck::closure_inferred_mut)] #[label(borrowck_closure_inferred_mut)]
FnMutInferred { FnMutInferred {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -84,17 +84,17 @@ pub(crate) enum VarHereDenote {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub(crate) enum FnMutReturnTypeErr { pub(crate) enum FnMutReturnTypeErr {
#[label(borrowck::returned_closure_escaped)] #[label(borrowck_returned_closure_escaped)]
ReturnClosure { ReturnClosure {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(borrowck::returned_async_block_escaped)] #[label(borrowck_returned_async_block_escaped)]
ReturnAsyncBlock { ReturnAsyncBlock {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(borrowck::returned_ref_escaped)] #[label(borrowck_returned_ref_escaped)]
ReturnRef { ReturnRef {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -102,7 +102,7 @@ pub(crate) enum FnMutReturnTypeErr {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(borrowck::lifetime_constraints_error)] #[diag(borrowck_lifetime_constraints_error)]
pub(crate) struct LifetimeOutliveErr { pub(crate) struct LifetimeOutliveErr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -110,7 +110,7 @@ pub(crate) struct LifetimeOutliveErr {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub(crate) enum LifetimeReturnCategoryErr<'a> { pub(crate) enum LifetimeReturnCategoryErr<'a> {
#[label(borrowck::returned_lifetime_wrong)] #[label(borrowck_returned_lifetime_wrong)]
WrongReturn { WrongReturn {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -118,7 +118,7 @@ pub(crate) enum LifetimeReturnCategoryErr<'a> {
outlived_fr_name: RegionName, outlived_fr_name: RegionName,
fr_name: &'a RegionName, fr_name: &'a RegionName,
}, },
#[label(borrowck::returned_lifetime_short)] #[label(borrowck_returned_lifetime_short)]
ShortReturn { ShortReturn {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -142,7 +142,7 @@ impl IntoDiagnosticArg for RegionName {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub(crate) enum RequireStaticErr { pub(crate) enum RequireStaticErr {
#[note(borrowck::used_impl_require_static)] #[note(borrowck_used_impl_require_static)]
UsedImpl { UsedImpl {
#[primary_span] #[primary_span]
multi_span: MultiSpan, multi_span: MultiSpan,

View File

@ -36,7 +36,7 @@ pub fn expand_cfg(
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(builtin_macros::requires_cfg_pattern)] #[diag(builtin_macros_requires_cfg_pattern)]
struct RequiresCfgPattern { struct RequiresCfgPattern {
#[primary_span] #[primary_span]
#[label] #[label]
@ -44,7 +44,7 @@ struct RequiresCfgPattern {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(builtin_macros::expected_one_cfg_pattern)] #[diag(builtin_macros_expected_one_cfg_pattern)]
struct OneCfgPattern { struct OneCfgPattern {
#[primary_span] #[primary_span]
span: Span, span: Span,

View File

@ -17,7 +17,7 @@ impl IntoDiagnosticArg for ExitCode {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::ranlib_failure)] #[diag(codegen_gcc_ranlib_failure)]
pub(crate) struct RanlibFailure { pub(crate) struct RanlibFailure {
exit_code: ExitCode, exit_code: ExitCode,
} }
@ -29,7 +29,7 @@ impl RanlibFailure {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_basic_integer, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_basic_integer, code = "E0511")]
pub(crate) struct InvalidMonomorphizationBasicInteger<'a> { pub(crate) struct InvalidMonomorphizationBasicInteger<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -38,7 +38,7 @@ pub(crate) struct InvalidMonomorphizationBasicInteger<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_invalid_float_vector, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_invalid_float_vector, code = "E0511")]
pub(crate) struct InvalidMonomorphizationInvalidFloatVector<'a> { pub(crate) struct InvalidMonomorphizationInvalidFloatVector<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -48,7 +48,7 @@ pub(crate) struct InvalidMonomorphizationInvalidFloatVector<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_not_float, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_not_float, code = "E0511")]
pub(crate) struct InvalidMonomorphizationNotFloat<'a> { pub(crate) struct InvalidMonomorphizationNotFloat<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -57,7 +57,7 @@ pub(crate) struct InvalidMonomorphizationNotFloat<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_unrecognized, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_unrecognized, code = "E0511")]
pub(crate) struct InvalidMonomorphizationUnrecognized { pub(crate) struct InvalidMonomorphizationUnrecognized {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -65,7 +65,7 @@ pub(crate) struct InvalidMonomorphizationUnrecognized {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_expected_signed_unsigned, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_expected_signed_unsigned, code = "E0511")]
pub(crate) struct InvalidMonomorphizationExpectedSignedUnsigned<'a> { pub(crate) struct InvalidMonomorphizationExpectedSignedUnsigned<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -75,7 +75,7 @@ pub(crate) struct InvalidMonomorphizationExpectedSignedUnsigned<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_unsupported_element, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_unsupported_element, code = "E0511")]
pub(crate) struct InvalidMonomorphizationUnsupportedElement<'a> { pub(crate) struct InvalidMonomorphizationUnsupportedElement<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -86,7 +86,7 @@ pub(crate) struct InvalidMonomorphizationUnsupportedElement<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_invalid_bitmask, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_invalid_bitmask, code = "E0511")]
pub(crate) struct InvalidMonomorphizationInvalidBitmask<'a> { pub(crate) struct InvalidMonomorphizationInvalidBitmask<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -97,7 +97,7 @@ pub(crate) struct InvalidMonomorphizationInvalidBitmask<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_simd_shuffle, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_simd_shuffle, code = "E0511")]
pub(crate) struct InvalidMonomorphizationSimdShuffle<'a> { pub(crate) struct InvalidMonomorphizationSimdShuffle<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -106,7 +106,7 @@ pub(crate) struct InvalidMonomorphizationSimdShuffle<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_expected_simd, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_expected_simd, code = "E0511")]
pub(crate) struct InvalidMonomorphizationExpectedSimd<'a> { pub(crate) struct InvalidMonomorphizationExpectedSimd<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -116,7 +116,7 @@ pub(crate) struct InvalidMonomorphizationExpectedSimd<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_mask_type, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_mask_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationMaskType<'a> { pub(crate) struct InvalidMonomorphizationMaskType<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -125,7 +125,7 @@ pub(crate) struct InvalidMonomorphizationMaskType<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_return_length, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_return_length, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnLength<'a> { pub(crate) struct InvalidMonomorphizationReturnLength<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -136,7 +136,7 @@ pub(crate) struct InvalidMonomorphizationReturnLength<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_return_length_input_type, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_return_length_input_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnLengthInputType<'a> { pub(crate) struct InvalidMonomorphizationReturnLengthInputType<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -148,7 +148,7 @@ pub(crate) struct InvalidMonomorphizationReturnLengthInputType<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_return_element, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_return_element, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnElement<'a> { pub(crate) struct InvalidMonomorphizationReturnElement<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -160,7 +160,7 @@ pub(crate) struct InvalidMonomorphizationReturnElement<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_return_type, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_return_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnType<'a> { pub(crate) struct InvalidMonomorphizationReturnType<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -171,7 +171,7 @@ pub(crate) struct InvalidMonomorphizationReturnType<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_inserted_type, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_inserted_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationInsertedType<'a> { pub(crate) struct InvalidMonomorphizationInsertedType<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -182,7 +182,7 @@ pub(crate) struct InvalidMonomorphizationInsertedType<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_return_integer_type, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_return_integer_type, code = "E0511")]
pub(crate) struct InvalidMonomorphizationReturnIntegerType<'a> { pub(crate) struct InvalidMonomorphizationReturnIntegerType<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -192,7 +192,7 @@ pub(crate) struct InvalidMonomorphizationReturnIntegerType<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_mismatched_lengths, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_mismatched_lengths, code = "E0511")]
pub(crate) struct InvalidMonomorphizationMismatchedLengths { pub(crate) struct InvalidMonomorphizationMismatchedLengths {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -202,7 +202,7 @@ pub(crate) struct InvalidMonomorphizationMismatchedLengths {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_unsupported_cast, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_unsupported_cast, code = "E0511")]
pub(crate) struct InvalidMonomorphizationUnsupportedCast<'a> { pub(crate) struct InvalidMonomorphizationUnsupportedCast<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -214,7 +214,7 @@ pub(crate) struct InvalidMonomorphizationUnsupportedCast<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::invalid_monomorphization_unsupported_operation, code = "E0511")] #[diag(codegen_gcc_invalid_monomorphization_unsupported_operation, code = "E0511")]
pub(crate) struct InvalidMonomorphizationUnsupportedOperation<'a> { pub(crate) struct InvalidMonomorphizationUnsupportedOperation<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -224,18 +224,18 @@ pub(crate) struct InvalidMonomorphizationUnsupportedOperation<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::linkage_const_or_mut_type)] #[diag(codegen_gcc_linkage_const_or_mut_type)]
pub(crate) struct LinkageConstOrMutType { pub(crate) struct LinkageConstOrMutType {
#[primary_span] #[primary_span]
pub span: Span pub span: Span
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::lto_not_supported)] #[diag(codegen_gcc_lto_not_supported)]
pub(crate) struct LTONotSupported; pub(crate) struct LTONotSupported;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_gcc::unwinding_inline_asm)] #[diag(codegen_gcc_unwinding_inline_asm)]
pub(crate) struct UnwindingInlineAsm { pub(crate) struct UnwindingInlineAsm {
#[primary_span] #[primary_span]
pub span: Span pub span: Span

View File

@ -13,43 +13,43 @@ use std::path::{Path, PathBuf};
use std::process::ExitStatus; use std::process::ExitStatus;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::lib_def_write_failure)] #[diag(codegen_ssa_lib_def_write_failure)]
pub struct LibDefWriteFailure { pub struct LibDefWriteFailure {
pub error: Error, pub error: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::version_script_write_failure)] #[diag(codegen_ssa_version_script_write_failure)]
pub struct VersionScriptWriteFailure { pub struct VersionScriptWriteFailure {
pub error: Error, pub error: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::symbol_file_write_failure)] #[diag(codegen_ssa_symbol_file_write_failure)]
pub struct SymbolFileWriteFailure { pub struct SymbolFileWriteFailure {
pub error: Error, pub error: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::ld64_unimplemented_modifier)] #[diag(codegen_ssa_ld64_unimplemented_modifier)]
pub struct Ld64UnimplementedModifier; pub struct Ld64UnimplementedModifier;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::linker_unsupported_modifier)] #[diag(codegen_ssa_linker_unsupported_modifier)]
pub struct LinkerUnsupportedModifier; pub struct LinkerUnsupportedModifier;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::L4Bender_exporting_symbols_unimplemented)] #[diag(codegen_ssa_L4Bender_exporting_symbols_unimplemented)]
pub struct L4BenderExportingSymbolsUnimplemented; pub struct L4BenderExportingSymbolsUnimplemented;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::no_natvis_directory)] #[diag(codegen_ssa_no_natvis_directory)]
pub struct NoNatvisDirectory { pub struct NoNatvisDirectory {
pub error: Error, pub error: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::copy_path_buf)] #[diag(codegen_ssa_copy_path_buf)]
pub struct CopyPathBuf { pub struct CopyPathBuf {
pub source_file: PathBuf, pub source_file: PathBuf,
pub output_path: PathBuf, pub output_path: PathBuf,
@ -58,7 +58,7 @@ pub struct CopyPathBuf {
// Reports Paths using `Debug` implementation rather than Path's `Display` implementation. // Reports Paths using `Debug` implementation rather than Path's `Display` implementation.
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::copy_path)] #[diag(codegen_ssa_copy_path)]
pub struct CopyPath<'a> { pub struct CopyPath<'a> {
from: DebugArgPath<'a>, from: DebugArgPath<'a>,
to: DebugArgPath<'a>, to: DebugArgPath<'a>,
@ -80,36 +80,36 @@ impl IntoDiagnosticArg for DebugArgPath<'_> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::ignoring_emit_path)] #[diag(codegen_ssa_ignoring_emit_path)]
pub struct IgnoringEmitPath { pub struct IgnoringEmitPath {
pub extension: String, pub extension: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::ignoring_output)] #[diag(codegen_ssa_ignoring_output)]
pub struct IgnoringOutput { pub struct IgnoringOutput {
pub extension: String, pub extension: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::create_temp_dir)] #[diag(codegen_ssa_create_temp_dir)]
pub struct CreateTempDir { pub struct CreateTempDir {
pub error: Error, pub error: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::incompatible_linking_modifiers)] #[diag(codegen_ssa_incompatible_linking_modifiers)]
pub struct IncompatibleLinkingModifiers; pub struct IncompatibleLinkingModifiers;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::add_native_library)] #[diag(codegen_ssa_add_native_library)]
pub struct AddNativeLibrary { pub struct AddNativeLibrary {
pub library_path: PathBuf, pub library_path: PathBuf,
pub error: Error, pub error: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(codegen_ssa::multiple_external_func_decl)] #[diag(codegen_ssa_multiple_external_func_decl)]
pub struct MultipleExternalFuncDecl<'a> { pub struct MultipleExternalFuncDecl<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -119,13 +119,13 @@ pub struct MultipleExternalFuncDecl<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
pub enum LinkRlibError { pub enum LinkRlibError {
#[diag(codegen_ssa::rlib_missing_format)] #[diag(codegen_ssa_rlib_missing_format)]
MissingFormat, MissingFormat,
#[diag(codegen_ssa::rlib_only_rmeta_found)] #[diag(codegen_ssa_rlib_only_rmeta_found)]
OnlyRmetaFound { crate_name: Symbol }, OnlyRmetaFound { crate_name: Symbol },
#[diag(codegen_ssa::rlib_not_found)] #[diag(codegen_ssa_rlib_not_found)]
NotFound { crate_name: Symbol }, NotFound { crate_name: Symbol },
} }
@ -136,188 +136,188 @@ impl IntoDiagnostic<'_> for ThorinErrorWrapper {
let mut diag; let mut diag;
match self.0 { match self.0 {
thorin::Error::ReadInput(_) => { thorin::Error::ReadInput(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_read_input_failure); diag = handler.struct_err(fluent::codegen_ssa_thorin_read_input_failure);
diag diag
} }
thorin::Error::ParseFileKind(_) => { thorin::Error::ParseFileKind(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_input_file_kind); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_input_file_kind);
diag diag
} }
thorin::Error::ParseObjectFile(_) => { thorin::Error::ParseObjectFile(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_input_object_file); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_input_object_file);
diag diag
} }
thorin::Error::ParseArchiveFile(_) => { thorin::Error::ParseArchiveFile(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_input_archive_file); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_input_archive_file);
diag diag
} }
thorin::Error::ParseArchiveMember(_) => { thorin::Error::ParseArchiveMember(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_archive_member); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_archive_member);
diag diag
} }
thorin::Error::InvalidInputKind => { thorin::Error::InvalidInputKind => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_invalid_input_kind); diag = handler.struct_err(fluent::codegen_ssa_thorin_invalid_input_kind);
diag diag
} }
thorin::Error::DecompressData(_) => { thorin::Error::DecompressData(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_decompress_data); diag = handler.struct_err(fluent::codegen_ssa_thorin_decompress_data);
diag diag
} }
thorin::Error::NamelessSection(_, offset) => { thorin::Error::NamelessSection(_, offset) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_section_without_name); diag = handler.struct_err(fluent::codegen_ssa_thorin_section_without_name);
diag.set_arg("offset", format!("0x{:08x}", offset)); diag.set_arg("offset", format!("0x{:08x}", offset));
diag diag
} }
thorin::Error::RelocationWithInvalidSymbol(section, offset) => { thorin::Error::RelocationWithInvalidSymbol(section, offset) => {
diag = diag =
handler.struct_err(fluent::codegen_ssa::thorin_relocation_with_invalid_symbol); handler.struct_err(fluent::codegen_ssa_thorin_relocation_with_invalid_symbol);
diag.set_arg("section", section); diag.set_arg("section", section);
diag.set_arg("offset", format!("0x{:08x}", offset)); diag.set_arg("offset", format!("0x{:08x}", offset));
diag diag
} }
thorin::Error::MultipleRelocations(section, offset) => { thorin::Error::MultipleRelocations(section, offset) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_multiple_relocations); diag = handler.struct_err(fluent::codegen_ssa_thorin_multiple_relocations);
diag.set_arg("section", section); diag.set_arg("section", section);
diag.set_arg("offset", format!("0x{:08x}", offset)); diag.set_arg("offset", format!("0x{:08x}", offset));
diag diag
} }
thorin::Error::UnsupportedRelocation(section, offset) => { thorin::Error::UnsupportedRelocation(section, offset) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_unsupported_relocation); diag = handler.struct_err(fluent::codegen_ssa_thorin_unsupported_relocation);
diag.set_arg("section", section); diag.set_arg("section", section);
diag.set_arg("offset", format!("0x{:08x}", offset)); diag.set_arg("offset", format!("0x{:08x}", offset));
diag diag
} }
thorin::Error::MissingDwoName(id) => { thorin::Error::MissingDwoName(id) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_missing_dwo_name); diag = handler.struct_err(fluent::codegen_ssa_thorin_missing_dwo_name);
diag.set_arg("id", format!("0x{:08x}", id)); diag.set_arg("id", format!("0x{:08x}", id));
diag diag
} }
thorin::Error::NoCompilationUnits => { thorin::Error::NoCompilationUnits => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_no_compilation_units); diag = handler.struct_err(fluent::codegen_ssa_thorin_no_compilation_units);
diag diag
} }
thorin::Error::NoDie => { thorin::Error::NoDie => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_no_die); diag = handler.struct_err(fluent::codegen_ssa_thorin_no_die);
diag diag
} }
thorin::Error::TopLevelDieNotUnit => { thorin::Error::TopLevelDieNotUnit => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_top_level_die_not_unit); diag = handler.struct_err(fluent::codegen_ssa_thorin_top_level_die_not_unit);
diag diag
} }
thorin::Error::MissingRequiredSection(section) => { thorin::Error::MissingRequiredSection(section) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_missing_required_section); diag = handler.struct_err(fluent::codegen_ssa_thorin_missing_required_section);
diag.set_arg("section", section); diag.set_arg("section", section);
diag diag
} }
thorin::Error::ParseUnitAbbreviations(_) => { thorin::Error::ParseUnitAbbreviations(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_unit_abbreviations); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_unit_abbreviations);
diag diag
} }
thorin::Error::ParseUnitAttribute(_) => { thorin::Error::ParseUnitAttribute(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_unit_attribute); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_unit_attribute);
diag diag
} }
thorin::Error::ParseUnitHeader(_) => { thorin::Error::ParseUnitHeader(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_unit_header); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_unit_header);
diag diag
} }
thorin::Error::ParseUnit(_) => { thorin::Error::ParseUnit(_) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_unit); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_unit);
diag diag
} }
thorin::Error::IncompatibleIndexVersion(section, format, actual) => { thorin::Error::IncompatibleIndexVersion(section, format, actual) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_incompatible_index_version); diag = handler.struct_err(fluent::codegen_ssa_thorin_incompatible_index_version);
diag.set_arg("section", section); diag.set_arg("section", section);
diag.set_arg("actual", actual); diag.set_arg("actual", actual);
diag.set_arg("format", format); diag.set_arg("format", format);
diag diag
} }
thorin::Error::OffsetAtIndex(_, index) => { thorin::Error::OffsetAtIndex(_, index) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_offset_at_index); diag = handler.struct_err(fluent::codegen_ssa_thorin_offset_at_index);
diag.set_arg("index", index); diag.set_arg("index", index);
diag diag
} }
thorin::Error::StrAtOffset(_, offset) => { thorin::Error::StrAtOffset(_, offset) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_str_at_offset); diag = handler.struct_err(fluent::codegen_ssa_thorin_str_at_offset);
diag.set_arg("offset", format!("0x{:08x}", offset)); diag.set_arg("offset", format!("0x{:08x}", offset));
diag diag
} }
thorin::Error::ParseIndex(_, section) => { thorin::Error::ParseIndex(_, section) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_parse_index); diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_index);
diag.set_arg("section", section); diag.set_arg("section", section);
diag diag
} }
thorin::Error::UnitNotInIndex(unit) => { thorin::Error::UnitNotInIndex(unit) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_unit_not_in_index); diag = handler.struct_err(fluent::codegen_ssa_thorin_unit_not_in_index);
diag.set_arg("unit", format!("0x{:08x}", unit)); diag.set_arg("unit", format!("0x{:08x}", unit));
diag diag
} }
thorin::Error::RowNotInIndex(_, row) => { thorin::Error::RowNotInIndex(_, row) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_row_not_in_index); diag = handler.struct_err(fluent::codegen_ssa_thorin_row_not_in_index);
diag.set_arg("row", row); diag.set_arg("row", row);
diag diag
} }
thorin::Error::SectionNotInRow => { thorin::Error::SectionNotInRow => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_section_not_in_row); diag = handler.struct_err(fluent::codegen_ssa_thorin_section_not_in_row);
diag diag
} }
thorin::Error::EmptyUnit(unit) => { thorin::Error::EmptyUnit(unit) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_empty_unit); diag = handler.struct_err(fluent::codegen_ssa_thorin_empty_unit);
diag.set_arg("unit", format!("0x{:08x}", unit)); diag.set_arg("unit", format!("0x{:08x}", unit));
diag diag
} }
thorin::Error::MultipleDebugInfoSection => { thorin::Error::MultipleDebugInfoSection => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_multiple_debug_info_section); diag = handler.struct_err(fluent::codegen_ssa_thorin_multiple_debug_info_section);
diag diag
} }
thorin::Error::MultipleDebugTypesSection => { thorin::Error::MultipleDebugTypesSection => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_multiple_debug_types_section); diag = handler.struct_err(fluent::codegen_ssa_thorin_multiple_debug_types_section);
diag diag
} }
thorin::Error::NotSplitUnit => { thorin::Error::NotSplitUnit => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_not_split_unit); diag = handler.struct_err(fluent::codegen_ssa_thorin_not_split_unit);
diag diag
} }
thorin::Error::DuplicateUnit(unit) => { thorin::Error::DuplicateUnit(unit) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_duplicate_unit); diag = handler.struct_err(fluent::codegen_ssa_thorin_duplicate_unit);
diag.set_arg("unit", format!("0x{:08x}", unit)); diag.set_arg("unit", format!("0x{:08x}", unit));
diag diag
} }
thorin::Error::MissingReferencedUnit(unit) => { thorin::Error::MissingReferencedUnit(unit) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_missing_referenced_unit); diag = handler.struct_err(fluent::codegen_ssa_thorin_missing_referenced_unit);
diag.set_arg("unit", format!("0x{:08x}", unit)); diag.set_arg("unit", format!("0x{:08x}", unit));
diag diag
} }
thorin::Error::NoOutputObjectCreated => { thorin::Error::NoOutputObjectCreated => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_not_output_object_created); diag = handler.struct_err(fluent::codegen_ssa_thorin_not_output_object_created);
diag diag
} }
thorin::Error::MixedInputEncodings => { thorin::Error::MixedInputEncodings => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_mixed_input_encodings); diag = handler.struct_err(fluent::codegen_ssa_thorin_mixed_input_encodings);
diag diag
} }
thorin::Error::Io(e) => { thorin::Error::Io(e) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_io); diag = handler.struct_err(fluent::codegen_ssa_thorin_io);
diag.set_arg("error", format!("{e}")); diag.set_arg("error", format!("{e}"));
diag diag
} }
thorin::Error::ObjectRead(e) => { thorin::Error::ObjectRead(e) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_object_read); diag = handler.struct_err(fluent::codegen_ssa_thorin_object_read);
diag.set_arg("error", format!("{e}")); diag.set_arg("error", format!("{e}"));
diag diag
} }
thorin::Error::ObjectWrite(e) => { thorin::Error::ObjectWrite(e) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_object_write); diag = handler.struct_err(fluent::codegen_ssa_thorin_object_write);
diag.set_arg("error", format!("{e}")); diag.set_arg("error", format!("{e}"));
diag diag
} }
thorin::Error::GimliRead(e) => { thorin::Error::GimliRead(e) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_gimli_read); diag = handler.struct_err(fluent::codegen_ssa_thorin_gimli_read);
diag.set_arg("error", format!("{e}")); diag.set_arg("error", format!("{e}"));
diag diag
} }
thorin::Error::GimliWrite(e) => { thorin::Error::GimliWrite(e) => {
diag = handler.struct_err(fluent::codegen_ssa::thorin_gimli_write); diag = handler.struct_err(fluent::codegen_ssa_thorin_gimli_write);
diag.set_arg("error", format!("{e}")); diag.set_arg("error", format!("{e}"));
diag diag
} }
@ -335,7 +335,7 @@ pub struct LinkingFailed<'a> {
impl IntoDiagnostic<'_> for LinkingFailed<'_> { impl IntoDiagnostic<'_> for LinkingFailed<'_> {
fn into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> { fn into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
let mut diag = handler.struct_err(fluent::codegen_ssa::linking_failed); let mut diag = handler.struct_err(fluent::codegen_ssa_linking_failed);
diag.set_arg("linker_path", format!("{}", self.linker_path.display())); diag.set_arg("linker_path", format!("{}", self.linker_path.display()));
diag.set_arg("exit_status", format!("{}", self.exit_status)); diag.set_arg("exit_status", format!("{}", self.exit_status));
@ -344,9 +344,9 @@ impl IntoDiagnostic<'_> for LinkingFailed<'_> {
// Trying to match an error from OS linkers // Trying to match an error from OS linkers
// which by now we have no way to translate. // which by now we have no way to translate.
if self.escaped_output.contains("undefined reference to") { if self.escaped_output.contains("undefined reference to") {
diag.note(fluent::codegen_ssa::extern_funcs_not_found) diag.note(fluent::codegen_ssa_extern_funcs_not_found)
.note(fluent::codegen_ssa::specify_libraries_to_link) .note(fluent::codegen_ssa_specify_libraries_to_link)
.note(fluent::codegen_ssa::use_cargo_directive); .note(fluent::codegen_ssa_use_cargo_directive);
} }
diag diag
} }

View File

@ -3,18 +3,18 @@ use rustc_macros::Diagnostic;
use rustc_span::Span; use rustc_span::Span;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::unstable_in_stable)] #[diag(const_eval_unstable_in_stable)]
pub(crate) struct UnstableInStable { pub(crate) struct UnstableInStable {
pub gate: String, pub gate: String,
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[suggestion( #[suggestion(
const_eval::unstable_sugg, unstable_sugg,
code = "#[rustc_const_unstable(feature = \"...\", issue = \"...\")]\n", code = "#[rustc_const_unstable(feature = \"...\", issue = \"...\")]\n",
applicability = "has-placeholders" applicability = "has-placeholders"
)] )]
#[suggestion( #[suggestion(
const_eval::bypass_sugg, bypass_sugg,
code = "#[rustc_allow_const_fn_unstable({gate})]\n", code = "#[rustc_allow_const_fn_unstable({gate})]\n",
applicability = "has-placeholders" applicability = "has-placeholders"
)] )]
@ -22,35 +22,35 @@ pub(crate) struct UnstableInStable {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::thread_local_access, code = "E0625")] #[diag(const_eval_thread_local_access, code = "E0625")]
pub(crate) struct NonConstOpErr { pub(crate) struct NonConstOpErr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::static_access, code = "E0013")] #[diag(const_eval_static_access, code = "E0013")]
#[help] #[help]
pub(crate) struct StaticAccessErr { pub(crate) struct StaticAccessErr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval::teach_note)] #[note(teach_note)]
#[help(const_eval::teach_help)] #[help(teach_help)]
pub teach: Option<()>, pub teach: Option<()>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::raw_ptr_to_int)] #[diag(const_eval_raw_ptr_to_int)]
#[note] #[note]
#[note(const_eval::note2)] #[note(note2)]
pub(crate) struct RawPtrToIntErr { pub(crate) struct RawPtrToIntErr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::raw_ptr_comparison)] #[diag(const_eval_raw_ptr_comparison)]
#[note] #[note]
pub(crate) struct RawPtrComparisonErr { pub(crate) struct RawPtrComparisonErr {
#[primary_span] #[primary_span]
@ -58,14 +58,14 @@ pub(crate) struct RawPtrComparisonErr {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::panic_non_str)] #[diag(const_eval_panic_non_str)]
pub(crate) struct PanicNonStrErr { pub(crate) struct PanicNonStrErr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::mut_deref, code = "E0658")] #[diag(const_eval_mut_deref, code = "E0658")]
pub(crate) struct MutDerefErr { pub(crate) struct MutDerefErr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -73,7 +73,7 @@ pub(crate) struct MutDerefErr {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::transient_mut_borrow, code = "E0658")] #[diag(const_eval_transient_mut_borrow, code = "E0658")]
pub(crate) struct TransientMutBorrowErr { pub(crate) struct TransientMutBorrowErr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -81,7 +81,7 @@ pub(crate) struct TransientMutBorrowErr {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::transient_mut_borrow_raw, code = "E0658")] #[diag(const_eval_transient_mut_borrow_raw, code = "E0658")]
pub(crate) struct TransientMutBorrowErrRaw { pub(crate) struct TransientMutBorrowErrRaw {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -89,7 +89,7 @@ pub(crate) struct TransientMutBorrowErrRaw {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::max_num_nodes_in_const)] #[diag(const_eval_max_num_nodes_in_const)]
pub(crate) struct MaxNumNodesInConstErr { pub(crate) struct MaxNumNodesInConstErr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -97,7 +97,7 @@ pub(crate) struct MaxNumNodesInConstErr {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::unallowed_fn_pointer_call)] #[diag(const_eval_unallowed_fn_pointer_call)]
pub(crate) struct UnallowedFnPointerCall { pub(crate) struct UnallowedFnPointerCall {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -105,7 +105,7 @@ pub(crate) struct UnallowedFnPointerCall {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::unstable_const_fn)] #[diag(const_eval_unstable_const_fn)]
pub(crate) struct UnstableConstFn { pub(crate) struct UnstableConstFn {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -113,26 +113,26 @@ pub(crate) struct UnstableConstFn {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::unallowed_mutable_refs, code = "E0764")] #[diag(const_eval_unallowed_mutable_refs, code = "E0764")]
pub(crate) struct UnallowedMutableRefs { pub(crate) struct UnallowedMutableRefs {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval::teach_note)] #[note(teach_note)]
pub teach: Option<()>, pub teach: Option<()>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::unallowed_mutable_refs_raw, code = "E0764")] #[diag(const_eval_unallowed_mutable_refs_raw, code = "E0764")]
pub(crate) struct UnallowedMutableRefsRaw { pub(crate) struct UnallowedMutableRefsRaw {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval::teach_note)] #[note(teach_note)]
pub teach: Option<()>, pub teach: Option<()>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::non_const_fmt_macro_call, code = "E0015")] #[diag(const_eval_non_const_fmt_macro_call, code = "E0015")]
pub(crate) struct NonConstFmtMacroCall { pub(crate) struct NonConstFmtMacroCall {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -140,7 +140,7 @@ pub(crate) struct NonConstFmtMacroCall {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::non_const_fn_call, code = "E0015")] #[diag(const_eval_non_const_fn_call, code = "E0015")]
pub(crate) struct NonConstFnCall { pub(crate) struct NonConstFnCall {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -149,7 +149,7 @@ pub(crate) struct NonConstFnCall {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::unallowed_op_in_const_context)] #[diag(const_eval_unallowed_op_in_const_context)]
pub(crate) struct UnallowedOpInConstContext { pub(crate) struct UnallowedOpInConstContext {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -157,18 +157,18 @@ pub(crate) struct UnallowedOpInConstContext {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::unallowed_heap_allocations, code = "E0010")] #[diag(const_eval_unallowed_heap_allocations, code = "E0010")]
pub(crate) struct UnallowedHeapAllocations { pub(crate) struct UnallowedHeapAllocations {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval::teach_note)] #[note(teach_note)]
pub teach: Option<()>, pub teach: Option<()>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::unallowed_inline_asm, code = "E0015")] #[diag(const_eval_unallowed_inline_asm, code = "E0015")]
pub(crate) struct UnallowedInlineAsm { pub(crate) struct UnallowedInlineAsm {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -176,7 +176,7 @@ pub(crate) struct UnallowedInlineAsm {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::interior_mutable_data_refer, code = "E0492")] #[diag(const_eval_interior_mutable_data_refer, code = "E0492")]
pub(crate) struct InteriorMutableDataRefer { pub(crate) struct InteriorMutableDataRefer {
#[primary_span] #[primary_span]
#[label] #[label]
@ -184,12 +184,12 @@ pub(crate) struct InteriorMutableDataRefer {
#[help] #[help]
pub opt_help: Option<()>, pub opt_help: Option<()>,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval::teach_note)] #[note(teach_note)]
pub teach: Option<()>, pub teach: Option<()>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval::interior_mutability_borrow)] #[diag(const_eval_interior_mutability_borrow)]
pub(crate) struct InteriorMutabilityBorrow { pub(crate) struct InteriorMutabilityBorrow {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,

View File

@ -1,39 +1,39 @@
use rustc_macros::Diagnostic; use rustc_macros::Diagnostic;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(driver::rlink_unable_to_read)] #[diag(driver_rlink_unable_to_read)]
pub(crate) struct RlinkUnableToRead { pub(crate) struct RlinkUnableToRead {
pub err: std::io::Error, pub err: std::io::Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(driver::rlink_wrong_file_type)] #[diag(driver_rlink_wrong_file_type)]
pub(crate) struct RLinkWrongFileType; pub(crate) struct RLinkWrongFileType;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(driver::rlink_empty_version_number)] #[diag(driver_rlink_empty_version_number)]
pub(crate) struct RLinkEmptyVersionNumber; pub(crate) struct RLinkEmptyVersionNumber;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(driver::rlink_encoding_version_mismatch)] #[diag(driver_rlink_encoding_version_mismatch)]
pub(crate) struct RLinkEncodingVersionMismatch { pub(crate) struct RLinkEncodingVersionMismatch {
pub version_array: String, pub version_array: String,
pub rlink_version: u32, pub rlink_version: u32,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(driver::rlink_rustc_version_mismatch)] #[diag(driver_rlink_rustc_version_mismatch)]
pub(crate) struct RLinkRustcVersionMismatch<'a> { pub(crate) struct RLinkRustcVersionMismatch<'a> {
pub rustc_version: String, pub rustc_version: String,
pub current_version: &'a str, pub current_version: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(driver::rlink_no_a_file)] #[diag(driver_rlink_no_a_file)]
pub(crate) struct RlinkNotAFile; pub(crate) struct RlinkNotAFile;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(driver::unpretty_dump_fail)] #[diag(driver_unpretty_dump_fail)]
pub(crate) struct UnprettyDumpFail { pub(crate) struct UnprettyDumpFail {
pub path: String, pub path: String,
pub err: String, pub err: String,

View File

@ -175,14 +175,14 @@ impl IntoDiagnostic<'_, !> for TargetDataLayoutErrors<'_> {
let mut diag; let mut diag;
match self { match self {
TargetDataLayoutErrors::InvalidAddressSpace { addr_space, err, cause } => { TargetDataLayoutErrors::InvalidAddressSpace { addr_space, err, cause } => {
diag = handler.struct_fatal(fluent::errors::target_invalid_address_space); diag = handler.struct_fatal(fluent::errors_target_invalid_address_space);
diag.set_arg("addr_space", addr_space); diag.set_arg("addr_space", addr_space);
diag.set_arg("cause", cause); diag.set_arg("cause", cause);
diag.set_arg("err", err); diag.set_arg("err", err);
diag diag
} }
TargetDataLayoutErrors::InvalidBits { kind, bit, cause, err } => { TargetDataLayoutErrors::InvalidBits { kind, bit, cause, err } => {
diag = handler.struct_fatal(fluent::errors::target_invalid_bits); diag = handler.struct_fatal(fluent::errors_target_invalid_bits);
diag.set_arg("kind", kind); diag.set_arg("kind", kind);
diag.set_arg("bit", bit); diag.set_arg("bit", bit);
diag.set_arg("cause", cause); diag.set_arg("cause", cause);
@ -190,30 +190,30 @@ impl IntoDiagnostic<'_, !> for TargetDataLayoutErrors<'_> {
diag diag
} }
TargetDataLayoutErrors::MissingAlignment { cause } => { TargetDataLayoutErrors::MissingAlignment { cause } => {
diag = handler.struct_fatal(fluent::errors::target_missing_alignment); diag = handler.struct_fatal(fluent::errors_target_missing_alignment);
diag.set_arg("cause", cause); diag.set_arg("cause", cause);
diag diag
} }
TargetDataLayoutErrors::InvalidAlignment { cause, err } => { TargetDataLayoutErrors::InvalidAlignment { cause, err } => {
diag = handler.struct_fatal(fluent::errors::target_invalid_alignment); diag = handler.struct_fatal(fluent::errors_target_invalid_alignment);
diag.set_arg("cause", cause); diag.set_arg("cause", cause);
diag.set_arg("err", err); diag.set_arg("err", err);
diag diag
} }
TargetDataLayoutErrors::InconsistentTargetArchitecture { dl, target } => { TargetDataLayoutErrors::InconsistentTargetArchitecture { dl, target } => {
diag = handler.struct_fatal(fluent::errors::target_inconsistent_architecture); diag = handler.struct_fatal(fluent::errors_target_inconsistent_architecture);
diag.set_arg("dl", dl); diag.set_arg("dl", dl);
diag.set_arg("target", target); diag.set_arg("target", target);
diag diag
} }
TargetDataLayoutErrors::InconsistentTargetPointerWidth { pointer_size, target } => { TargetDataLayoutErrors::InconsistentTargetPointerWidth { pointer_size, target } => {
diag = handler.struct_fatal(fluent::errors::target_inconsistent_pointer_width); diag = handler.struct_fatal(fluent::errors_target_inconsistent_pointer_width);
diag.set_arg("pointer_size", pointer_size); diag.set_arg("pointer_size", pointer_size);
diag.set_arg("target", target); diag.set_arg("target", target);
diag diag
} }
TargetDataLayoutErrors::InvalidBitsSize { err } => { TargetDataLayoutErrors::InvalidBitsSize { err } => {
diag = handler.struct_fatal(fluent::errors::target_invalid_bits_size); diag = handler.struct_fatal(fluent::errors_target_invalid_bits_size);
diag.set_arg("err", err); diag.set_arg("err", err);
diag diag
} }

View File

@ -3,28 +3,28 @@ use rustc_span::symbol::MacroRulesNormalizedIdent;
use rustc_span::Span; use rustc_span::Span;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(expand::expr_repeat_no_syntax_vars)] #[diag(expand_expr_repeat_no_syntax_vars)]
pub(crate) struct NoSyntaxVarsExprRepeat { pub(crate) struct NoSyntaxVarsExprRepeat {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(expand::must_repeat_once)] #[diag(expand_must_repeat_once)]
pub(crate) struct MustRepeatOnce { pub(crate) struct MustRepeatOnce {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(expand::count_repetition_misplaced)] #[diag(expand_count_repetition_misplaced)]
pub(crate) struct CountRepetitionMisplaced { pub(crate) struct CountRepetitionMisplaced {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(expand::meta_var_expr_unrecognized_var)] #[diag(expand_meta_var_expr_unrecognized_var)]
pub(crate) struct MetaVarExprUnrecognizedVar { pub(crate) struct MetaVarExprUnrecognizedVar {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -32,7 +32,7 @@ pub(crate) struct MetaVarExprUnrecognizedVar {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(expand::var_still_repeating)] #[diag(expand_var_still_repeating)]
pub(crate) struct VarStillRepeating { pub(crate) struct VarStillRepeating {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -40,7 +40,7 @@ pub(crate) struct VarStillRepeating {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(expand::meta_var_dif_seq_matchers)] #[diag(expand_meta_var_dif_seq_matchers)]
pub(crate) struct MetaVarsDifSeqMatchers { pub(crate) struct MetaVarsDifSeqMatchers {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,

View File

@ -598,12 +598,12 @@ pub fn compile_declarative_macro(
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
enum ExplainDocComment { enum ExplainDocComment {
#[label(expand::explain_doc_comment_inner)] #[label(expand_explain_doc_comment_inner)]
Inner { Inner {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(expand::explain_doc_comment_outer)] #[label(expand_explain_doc_comment_outer)]
Outer { Outer {
#[primary_span] #[primary_span]
span: Span, span: Span,

View File

@ -7,7 +7,7 @@ use rustc_middle::ty::Ty;
use rustc_span::{symbol::Ident, Span, Symbol}; use rustc_span::{symbol::Ident, Span, Symbol};
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::unrecognized_atomic_operation, code = "E0092")] #[diag(hir_analysis_unrecognized_atomic_operation, code = "E0092")]
pub struct UnrecognizedAtomicOperation<'a> { pub struct UnrecognizedAtomicOperation<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
@ -16,7 +16,7 @@ pub struct UnrecognizedAtomicOperation<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::wrong_number_of_generic_arguments_to_intrinsic, code = "E0094")] #[diag(hir_analysis_wrong_number_of_generic_arguments_to_intrinsic, code = "E0094")]
pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> { pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
@ -27,7 +27,7 @@ pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::unrecognized_intrinsic_function, code = "E0093")] #[diag(hir_analysis_unrecognized_intrinsic_function, code = "E0093")]
pub struct UnrecognizedIntrinsicFunction { pub struct UnrecognizedIntrinsicFunction {
#[primary_span] #[primary_span]
#[label] #[label]
@ -36,19 +36,19 @@ pub struct UnrecognizedIntrinsicFunction {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::lifetimes_or_bounds_mismatch_on_trait, code = "E0195")] #[diag(hir_analysis_lifetimes_or_bounds_mismatch_on_trait, code = "E0195")]
pub struct LifetimesOrBoundsMismatchOnTrait { pub struct LifetimesOrBoundsMismatchOnTrait {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
#[label(hir_analysis::generics_label)] #[label(generics_label)]
pub generics_span: Option<Span>, pub generics_span: Option<Span>,
pub item_kind: &'static str, pub item_kind: &'static str,
pub ident: Ident, pub ident: Ident,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::drop_impl_on_wrong_item, code = "E0120")] #[diag(hir_analysis_drop_impl_on_wrong_item, code = "E0120")]
pub struct DropImplOnWrongItem { pub struct DropImplOnWrongItem {
#[primary_span] #[primary_span]
#[label] #[label]
@ -56,18 +56,18 @@ pub struct DropImplOnWrongItem {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::field_already_declared, code = "E0124")] #[diag(hir_analysis_field_already_declared, code = "E0124")]
pub struct FieldAlreadyDeclared { pub struct FieldAlreadyDeclared {
pub field_name: Ident, pub field_name: Ident,
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
#[label(hir_analysis::previous_decl_label)] #[label(previous_decl_label)]
pub prev_span: Span, pub prev_span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::copy_impl_on_type_with_dtor, code = "E0184")] #[diag(hir_analysis_copy_impl_on_type_with_dtor, code = "E0184")]
pub struct CopyImplOnTypeWithDtor { pub struct CopyImplOnTypeWithDtor {
#[primary_span] #[primary_span]
#[label] #[label]
@ -75,14 +75,14 @@ pub struct CopyImplOnTypeWithDtor {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::multiple_relaxed_default_bounds, code = "E0203")] #[diag(hir_analysis_multiple_relaxed_default_bounds, code = "E0203")]
pub struct MultipleRelaxedDefaultBounds { pub struct MultipleRelaxedDefaultBounds {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::copy_impl_on_non_adt, code = "E0206")] #[diag(hir_analysis_copy_impl_on_non_adt, code = "E0206")]
pub struct CopyImplOnNonAdt { pub struct CopyImplOnNonAdt {
#[primary_span] #[primary_span]
#[label] #[label]
@ -90,23 +90,23 @@ pub struct CopyImplOnNonAdt {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::trait_object_declared_with_no_traits, code = "E0224")] #[diag(hir_analysis_trait_object_declared_with_no_traits, code = "E0224")]
pub struct TraitObjectDeclaredWithNoTraits { pub struct TraitObjectDeclaredWithNoTraits {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label(hir_analysis::alias_span)] #[label(alias_span)]
pub trait_alias_span: Option<Span>, pub trait_alias_span: Option<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::ambiguous_lifetime_bound, code = "E0227")] #[diag(hir_analysis_ambiguous_lifetime_bound, code = "E0227")]
pub struct AmbiguousLifetimeBound { pub struct AmbiguousLifetimeBound {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::assoc_type_binding_not_allowed, code = "E0229")] #[diag(hir_analysis_assoc_type_binding_not_allowed, code = "E0229")]
pub struct AssocTypeBindingNotAllowed { pub struct AssocTypeBindingNotAllowed {
#[primary_span] #[primary_span]
#[label] #[label]
@ -114,7 +114,7 @@ pub struct AssocTypeBindingNotAllowed {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::typeof_reserved_keyword_used, code = "E0516")] #[diag(hir_analysis_typeof_reserved_keyword_used, code = "E0516")]
pub struct TypeofReservedKeywordUsed<'tcx> { pub struct TypeofReservedKeywordUsed<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
#[primary_span] #[primary_span]
@ -125,19 +125,19 @@ pub struct TypeofReservedKeywordUsed<'tcx> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::value_of_associated_struct_already_specified, code = "E0719")] #[diag(hir_analysis_value_of_associated_struct_already_specified, code = "E0719")]
pub struct ValueOfAssociatedStructAlreadySpecified { pub struct ValueOfAssociatedStructAlreadySpecified {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
#[label(hir_analysis::previous_bound_label)] #[label(previous_bound_label)]
pub prev_span: Span, pub prev_span: Span,
pub item_name: Ident, pub item_name: Ident,
pub def_path: String, pub def_path: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::unconstrained_opaque_type)] #[diag(hir_analysis_unconstrained_opaque_type)]
#[note] #[note]
pub struct UnconstrainedOpaqueType { pub struct UnconstrainedOpaqueType {
#[primary_span] #[primary_span]
@ -158,7 +158,7 @@ impl<'a> IntoDiagnostic<'a> for MissingTypeParams {
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> { fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let mut err = handler.struct_span_err_with_code( let mut err = handler.struct_span_err_with_code(
self.span, self.span,
rustc_errors::fluent::hir_analysis::missing_type_params, rustc_errors::fluent::hir_analysis_missing_type_params,
error_code!(E0393), error_code!(E0393),
); );
err.set_arg("parameterCount", self.missing_type_params.len()); err.set_arg("parameterCount", self.missing_type_params.len());
@ -171,7 +171,7 @@ impl<'a> IntoDiagnostic<'a> for MissingTypeParams {
.join(", "), .join(", "),
); );
err.span_label(self.def_span, rustc_errors::fluent::hir_analysis::label); err.span_label(self.def_span, rustc_errors::fluent::label);
let mut suggested = false; let mut suggested = false;
// Don't suggest setting the type params if there are some already: the order is // Don't suggest setting the type params if there are some already: the order is
@ -186,7 +186,7 @@ impl<'a> IntoDiagnostic<'a> for MissingTypeParams {
// least we can clue them to the correct syntax `Iterator<Type>`. // least we can clue them to the correct syntax `Iterator<Type>`.
err.span_suggestion( err.span_suggestion(
self.span, self.span,
rustc_errors::fluent::hir_analysis::suggestion, rustc_errors::fluent::suggestion,
format!( format!(
"{}<{}>", "{}<{}>",
snippet, snippet,
@ -202,16 +202,16 @@ impl<'a> IntoDiagnostic<'a> for MissingTypeParams {
} }
} }
if !suggested { if !suggested {
err.span_label(self.span, rustc_errors::fluent::hir_analysis::no_suggestion_label); err.span_label(self.span, rustc_errors::fluent::no_suggestion_label);
} }
err.note(rustc_errors::fluent::hir_analysis::note); err.note(rustc_errors::fluent::note);
err err
} }
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::manual_implementation, code = "E0183")] #[diag(hir_analysis_manual_implementation, code = "E0183")]
#[help] #[help]
pub struct ManualImplementation { pub struct ManualImplementation {
#[primary_span] #[primary_span]
@ -221,21 +221,21 @@ pub struct ManualImplementation {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::substs_on_overridden_impl)] #[diag(hir_analysis_substs_on_overridden_impl)]
pub struct SubstsOnOverriddenImpl { pub struct SubstsOnOverriddenImpl {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(hir_analysis::unused_extern_crate)] #[diag(hir_analysis_unused_extern_crate)]
pub struct UnusedExternCrate { pub struct UnusedExternCrate {
#[suggestion(applicability = "machine-applicable", code = "")] #[suggestion(applicability = "machine-applicable", code = "")]
pub span: Span, pub span: Span,
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(hir_analysis::extern_crate_not_idiomatic)] #[diag(hir_analysis_extern_crate_not_idiomatic)]
pub struct ExternCrateNotIdiomatic { pub struct ExternCrateNotIdiomatic {
#[suggestion_short(applicability = "machine-applicable", code = "{suggestion_code}")] #[suggestion_short(applicability = "machine-applicable", code = "{suggestion_code}")]
pub span: Span, pub span: Span,
@ -244,7 +244,7 @@ pub struct ExternCrateNotIdiomatic {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::expected_used_symbol)] #[diag(hir_analysis_expected_used_symbol)]
pub struct ExpectedUsedSymbol { pub struct ExpectedUsedSymbol {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,

View File

@ -4,36 +4,36 @@ use rustc_middle::ty::Ty;
use rustc_span::{symbol::Ident, Span}; use rustc_span::{symbol::Ident, Span};
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::field_multiply_specified_in_initializer, code = "E0062")] #[diag(hir_analysis_field_multiply_specified_in_initializer, code = "E0062")]
pub struct FieldMultiplySpecifiedInInitializer { pub struct FieldMultiplySpecifiedInInitializer {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
#[label(hir_analysis::previous_use_label)] #[label(previous_use_label)]
pub prev_span: Span, pub prev_span: Span,
pub ident: Ident, pub ident: Ident,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::return_stmt_outside_of_fn_body, code = "E0572")] #[diag(hir_analysis_return_stmt_outside_of_fn_body, code = "E0572")]
pub struct ReturnStmtOutsideOfFnBody { pub struct ReturnStmtOutsideOfFnBody {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label(hir_analysis::encl_body_label)] #[label(encl_body_label)]
pub encl_body_span: Option<Span>, pub encl_body_span: Option<Span>,
#[label(hir_analysis::encl_fn_label)] #[label(encl_fn_label)]
pub encl_fn_span: Option<Span>, pub encl_fn_span: Option<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::yield_expr_outside_of_generator, code = "E0627")] #[diag(hir_analysis_yield_expr_outside_of_generator, code = "E0627")]
pub struct YieldExprOutsideOfGenerator { pub struct YieldExprOutsideOfGenerator {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::struct_expr_non_exhaustive, code = "E0639")] #[diag(hir_analysis_struct_expr_non_exhaustive, code = "E0639")]
pub struct StructExprNonExhaustive { pub struct StructExprNonExhaustive {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -41,21 +41,21 @@ pub struct StructExprNonExhaustive {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::method_call_on_unknown_type, code = "E0699")] #[diag(hir_analysis_method_call_on_unknown_type, code = "E0699")]
pub struct MethodCallOnUnknownType { pub struct MethodCallOnUnknownType {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::functional_record_update_on_non_struct, code = "E0436")] #[diag(hir_analysis_functional_record_update_on_non_struct, code = "E0436")]
pub struct FunctionalRecordUpdateOnNonStruct { pub struct FunctionalRecordUpdateOnNonStruct {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::address_of_temporary_taken, code = "E0745")] #[diag(hir_analysis_address_of_temporary_taken, code = "E0745")]
pub struct AddressOfTemporaryTaken { pub struct AddressOfTemporaryTaken {
#[primary_span] #[primary_span]
#[label] #[label]
@ -65,7 +65,7 @@ pub struct AddressOfTemporaryTaken {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum AddReturnTypeSuggestion { pub enum AddReturnTypeSuggestion {
#[suggestion( #[suggestion(
hir_analysis::add_return_type_add, hir_analysis_add_return_type_add,
code = "-> {found} ", code = "-> {found} ",
applicability = "machine-applicable" applicability = "machine-applicable"
)] )]
@ -75,7 +75,7 @@ pub enum AddReturnTypeSuggestion {
found: String, found: String,
}, },
#[suggestion( #[suggestion(
hir_analysis::add_return_type_missing_here, hir_analysis_add_return_type_missing_here,
code = "-> _ ", code = "-> _ ",
applicability = "has-placeholders" applicability = "has-placeholders"
)] )]
@ -87,12 +87,12 @@ pub enum AddReturnTypeSuggestion {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum ExpectedReturnTypeLabel<'tcx> { pub enum ExpectedReturnTypeLabel<'tcx> {
#[label(hir_analysis::expected_default_return_type)] #[label(hir_analysis_expected_default_return_type)]
Unit { Unit {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[label(hir_analysis::expected_return_type)] #[label(hir_analysis_expected_return_type)]
Other { Other {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -101,21 +101,20 @@ pub enum ExpectedReturnTypeLabel<'tcx> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis::missing_parentheses_in_range, code = "E0689")] #[diag(hir_analysis_missing_parentheses_in_range, code = "E0689")]
pub struct MissingParentheseInRange { pub struct MissingParentheseInRange {
#[primary_span] #[primary_span]
#[label(hir_analysis::missing_parentheses_in_range)] #[label(hir_analysis_missing_parentheses_in_range)]
pub span: Span, pub span: Span,
pub ty_str: String, pub ty_str: String,
pub method_name: String, pub method_name: String,
#[subdiagnostic] #[subdiagnostic]
pub add_missing_parentheses: Option<AddMissingParenthesesInRange>, pub add_missing_parentheses: Option<AddMissingParenthesesInRange>,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[multipart_suggestion_verbose( #[multipart_suggestion_verbose(
hir_analysis::add_missing_parentheses_in_range, hir_analysis_add_missing_parentheses_in_range,
applicability = "maybe-incorrect" applicability = "maybe-incorrect"
)] )]
pub struct AddMissingParenthesesInRange { pub struct AddMissingParenthesesInRange {

View File

@ -18,19 +18,19 @@ use crate::infer::error_reporting::{
pub mod note_and_explain; pub mod note_and_explain;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(infer::opaque_hidden_type)] #[diag(infer_opaque_hidden_type)]
pub struct OpaqueHiddenTypeDiag { pub struct OpaqueHiddenTypeDiag {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
#[note(infer::opaque_type)] #[note(opaque_type)]
pub opaque_type: Span, pub opaque_type: Span,
#[note(infer::hidden_type)] #[note(hidden_type)]
pub hidden_type: Span, pub hidden_type: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(infer::type_annotations_needed, code = "E0282")] #[diag(infer_type_annotations_needed, code = "E0282")]
pub struct AnnotationRequired<'a> { pub struct AnnotationRequired<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -48,7 +48,7 @@ pub struct AnnotationRequired<'a> {
// Copy of `AnnotationRequired` for E0283 // Copy of `AnnotationRequired` for E0283
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(infer::type_annotations_needed, code = "E0283")] #[diag(infer_type_annotations_needed, code = "E0283")]
pub struct AmbigousImpl<'a> { pub struct AmbigousImpl<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -66,7 +66,7 @@ pub struct AmbigousImpl<'a> {
// Copy of `AnnotationRequired` for E0284 // Copy of `AnnotationRequired` for E0284
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(infer::type_annotations_needed, code = "E0284")] #[diag(infer_type_annotations_needed, code = "E0284")]
pub struct AmbigousReturn<'a> { pub struct AmbigousReturn<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -83,7 +83,7 @@ pub struct AmbigousReturn<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(infer::need_type_info_in_generator, code = "E0698")] #[diag(infer_need_type_info_in_generator, code = "E0698")]
pub struct NeedTypeInfoInGenerator<'a> { pub struct NeedTypeInfoInGenerator<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -94,7 +94,7 @@ pub struct NeedTypeInfoInGenerator<'a> {
// Used when a better one isn't available // Used when a better one isn't available
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[label(infer::label_bad)] #[label(infer_label_bad)]
pub struct InferenceBadError<'a> { pub struct InferenceBadError<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -110,7 +110,7 @@ pub struct InferenceBadError<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum SourceKindSubdiag<'a> { pub enum SourceKindSubdiag<'a> {
#[suggestion_verbose( #[suggestion_verbose(
infer::source_kind_subdiag_let, infer_source_kind_subdiag_let,
code = ": {type_name}", code = ": {type_name}",
applicability = "has-placeholders" applicability = "has-placeholders"
)] )]
@ -125,7 +125,7 @@ pub enum SourceKindSubdiag<'a> {
prefix: &'a str, prefix: &'a str,
arg_name: String, arg_name: String,
}, },
#[label(infer::source_kind_subdiag_generic_label)] #[label(infer_source_kind_subdiag_generic_label)]
GenericLabel { GenericLabel {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -136,7 +136,7 @@ pub enum SourceKindSubdiag<'a> {
parent_name: String, parent_name: String,
}, },
#[suggestion_verbose( #[suggestion_verbose(
infer::source_kind_subdiag_generic_suggestion, infer_source_kind_subdiag_generic_suggestion,
code = "::<{args}>", code = "::<{args}>",
applicability = "has-placeholders" applicability = "has-placeholders"
)] )]
@ -151,7 +151,7 @@ pub enum SourceKindSubdiag<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum SourceKindMultiSuggestion<'a> { pub enum SourceKindMultiSuggestion<'a> {
#[multipart_suggestion_verbose( #[multipart_suggestion_verbose(
infer::source_kind_fully_qualified, infer_source_kind_fully_qualified,
applicability = "has-placeholders" applicability = "has-placeholders"
)] )]
FullyQualified { FullyQualified {
@ -164,7 +164,7 @@ pub enum SourceKindMultiSuggestion<'a> {
successor_pos: &'a str, successor_pos: &'a str,
}, },
#[multipart_suggestion_verbose( #[multipart_suggestion_verbose(
infer::source_kind_closure_return, infer_source_kind_closure_return,
applicability = "has-placeholders" applicability = "has-placeholders"
)] )]
ClosureReturn { ClosureReturn {
@ -260,7 +260,7 @@ impl AddToDiagnostic for RegionOriginNote<'_> {
requirement, requirement,
expected_found: Some((expected, found)), expected_found: Some((expected, found)),
} => { } => {
label_or_note(span, fluent::infer::subtype); label_or_note(span, fluent::infer_subtype);
diag.set_arg("requirement", requirement); diag.set_arg("requirement", requirement);
diag.note_expected_found(&"", expected, &"", found); diag.note_expected_found(&"", expected, &"", found);
@ -269,7 +269,7 @@ impl AddToDiagnostic for RegionOriginNote<'_> {
// FIXME: this really should be handled at some earlier stage. Our // FIXME: this really should be handled at some earlier stage. Our
// handling of region checking when type errors are present is // handling of region checking when type errors are present is
// *terrible*. // *terrible*.
label_or_note(span, fluent::infer::subtype_2); label_or_note(span, fluent::infer_subtype_2);
diag.set_arg("requirement", requirement); diag.set_arg("requirement", requirement);
} }
}; };
@ -300,9 +300,9 @@ impl AddToDiagnostic for LifetimeMismatchLabels {
{ {
match self { match self {
LifetimeMismatchLabels::InRet { param_span, ret_span, span, label_var1 } => { LifetimeMismatchLabels::InRet { param_span, ret_span, span, label_var1 } => {
diag.span_label(param_span, fluent::infer::declared_different); diag.span_label(param_span, fluent::infer_declared_different);
diag.span_label(ret_span, fluent::infer::nothing); diag.span_label(ret_span, fluent::infer_nothing);
diag.span_label(span, fluent::infer::data_returned); diag.span_label(span, fluent::infer_data_returned);
diag.set_arg("label_var1_exists", label_var1.is_some()); diag.set_arg("label_var1_exists", label_var1.is_some());
diag.set_arg("label_var1", label_var1.map(|x| x.to_string()).unwrap_or_default()); diag.set_arg("label_var1", label_var1.map(|x| x.to_string()).unwrap_or_default());
} }
@ -315,13 +315,13 @@ impl AddToDiagnostic for LifetimeMismatchLabels {
sub: label_var2, sub: label_var2,
} => { } => {
if hir_equal { if hir_equal {
diag.span_label(ty_sup, fluent::infer::declared_multiple); diag.span_label(ty_sup, fluent::infer_declared_multiple);
diag.span_label(ty_sub, fluent::infer::nothing); diag.span_label(ty_sub, fluent::infer_nothing);
diag.span_label(span, fluent::infer::data_lifetime_flow); diag.span_label(span, fluent::infer_data_lifetime_flow);
} else { } else {
diag.span_label(ty_sup, fluent::infer::types_declared_different); diag.span_label(ty_sup, fluent::infer_types_declared_different);
diag.span_label(ty_sub, fluent::infer::nothing); diag.span_label(ty_sub, fluent::infer_nothing);
diag.span_label(span, fluent::infer::data_flows); diag.span_label(span, fluent::infer_data_flows);
diag.set_arg("label_var1_exists", label_var1.is_some()); diag.set_arg("label_var1_exists", label_var1.is_some());
diag.set_arg( diag.set_arg(
"label_var1", "label_var1",
@ -419,7 +419,7 @@ impl AddToDiagnostic for AddLifetimeParamsSuggestion<'_> {
} }
diag.multipart_suggestion( diag.multipart_suggestion(
fluent::infer::lifetime_param_suggestion, fluent::infer_lifetime_param_suggestion,
suggestions, suggestions,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
@ -427,13 +427,13 @@ impl AddToDiagnostic for AddLifetimeParamsSuggestion<'_> {
true true
}; };
if mk_suggestion() && self.add_note { if mk_suggestion() && self.add_note {
diag.note(fluent::infer::lifetime_param_suggestion_elided); diag.note(fluent::infer_lifetime_param_suggestion_elided);
} }
} }
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(infer::lifetime_mismatch, code = "E0623")] #[diag(infer_lifetime_mismatch, code = "E0623")]
pub struct LifetimeMismatch<'a> { pub struct LifetimeMismatch<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -454,32 +454,32 @@ impl AddToDiagnostic for IntroducesStaticBecauseUnmetLifetimeReq {
F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage, F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
{ {
self.unmet_requirements self.unmet_requirements
.push_span_label(self.binding_span, fluent::infer::msl_introduces_static); .push_span_label(self.binding_span, fluent::infer_msl_introduces_static);
diag.span_note(self.unmet_requirements, fluent::infer::msl_unmet_req); diag.span_note(self.unmet_requirements, fluent::infer_msl_unmet_req);
} }
} }
// FIXME(#100717): replace with a `Option<Span>` when subdiagnostic supports that // FIXME(#100717): replace with a `Option<Span>` when subdiagnostic supports that
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum DoesNotOutliveStaticFromImpl { pub enum DoesNotOutliveStaticFromImpl {
#[note(infer::does_not_outlive_static_from_impl)] #[note(infer_does_not_outlive_static_from_impl)]
Spanned { Spanned {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[note(infer::does_not_outlive_static_from_impl)] #[note(infer_does_not_outlive_static_from_impl)]
Unspanned, Unspanned,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum ImplicitStaticLifetimeSubdiag { pub enum ImplicitStaticLifetimeSubdiag {
#[note(infer::implicit_static_lifetime_note)] #[note(infer_implicit_static_lifetime_note)]
Note { Note {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[suggestion_verbose( #[suggestion_verbose(
infer::implicit_static_lifetime_suggestion, infer_implicit_static_lifetime_suggestion,
code = " + '_", code = " + '_",
applicability = "maybe-incorrect" applicability = "maybe-incorrect"
)] )]
@ -490,7 +490,7 @@ pub enum ImplicitStaticLifetimeSubdiag {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(infer::mismatched_static_lifetime)] #[diag(infer_mismatched_static_lifetime)]
pub struct MismatchedStaticLifetime<'a> { pub struct MismatchedStaticLifetime<'a> {
#[primary_span] #[primary_span]
pub cause_span: Span, pub cause_span: Span,

View File

@ -166,9 +166,9 @@ impl AddToDiagnostic for RegionExplanation<'_> {
F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage, F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
{ {
if let Some(span) = self.desc.span { if let Some(span) = self.desc.span {
diag.span_note(span, fluent::infer::region_explanation); diag.span_note(span, fluent::infer_region_explanation);
} else { } else {
diag.note(fluent::infer::region_explanation); diag.note(fluent::infer_region_explanation);
} }
self.desc.add_to(diag); self.desc.add_to(diag);
diag.set_arg("pref_kind", self.prefix); diag.set_arg("pref_kind", self.prefix);

View File

@ -19,26 +19,27 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
expected_found: self.values_str(trace.values), expected_found: self.values_str(trace.values),
} }
.add_to_diagnostic(err), .add_to_diagnostic(err),
infer::Reborrow(span) => RegionOriginNote::Plain { span, msg: fluent::infer::reborrow } infer::Reborrow(span) => {
.add_to_diagnostic(err), RegionOriginNote::Plain { span, msg: fluent::infer_reborrow }.add_to_diagnostic(err)
}
infer::ReborrowUpvar(span, ref upvar_id) => { infer::ReborrowUpvar(span, ref upvar_id) => {
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id); let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
RegionOriginNote::WithName { RegionOriginNote::WithName {
span, span,
msg: fluent::infer::reborrow, msg: fluent::infer_reborrow,
name: &var_name.to_string(), name: &var_name.to_string(),
continues: false, continues: false,
} }
.add_to_diagnostic(err); .add_to_diagnostic(err);
} }
infer::RelateObjectBound(span) => { infer::RelateObjectBound(span) => {
RegionOriginNote::Plain { span, msg: fluent::infer::relate_object_bound } RegionOriginNote::Plain { span, msg: fluent::infer_relate_object_bound }
.add_to_diagnostic(err); .add_to_diagnostic(err);
} }
infer::DataBorrowed(ty, span) => { infer::DataBorrowed(ty, span) => {
RegionOriginNote::WithName { RegionOriginNote::WithName {
span, span,
msg: fluent::infer::data_borrowed, msg: fluent::infer_data_borrowed,
name: &self.ty_to_string(ty), name: &self.ty_to_string(ty),
continues: false, continues: false,
} }
@ -47,7 +48,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
infer::ReferenceOutlivesReferent(ty, span) => { infer::ReferenceOutlivesReferent(ty, span) => {
RegionOriginNote::WithName { RegionOriginNote::WithName {
span, span,
msg: fluent::infer::reference_outlives_referent, msg: fluent::infer_reference_outlives_referent,
name: &self.ty_to_string(ty), name: &self.ty_to_string(ty),
continues: false, continues: false,
} }
@ -56,22 +57,22 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
infer::RelateParamBound(span, ty, opt_span) => { infer::RelateParamBound(span, ty, opt_span) => {
RegionOriginNote::WithName { RegionOriginNote::WithName {
span, span,
msg: fluent::infer::relate_param_bound, msg: fluent::infer_relate_param_bound,
name: &self.ty_to_string(ty), name: &self.ty_to_string(ty),
continues: opt_span.is_some(), continues: opt_span.is_some(),
} }
.add_to_diagnostic(err); .add_to_diagnostic(err);
if let Some(span) = opt_span { if let Some(span) = opt_span {
RegionOriginNote::Plain { span, msg: fluent::infer::relate_param_bound_2 } RegionOriginNote::Plain { span, msg: fluent::infer_relate_param_bound_2 }
.add_to_diagnostic(err); .add_to_diagnostic(err);
} }
} }
infer::RelateRegionParamBound(span) => { infer::RelateRegionParamBound(span) => {
RegionOriginNote::Plain { span, msg: fluent::infer::relate_region_param_bound } RegionOriginNote::Plain { span, msg: fluent::infer_relate_region_param_bound }
.add_to_diagnostic(err); .add_to_diagnostic(err);
} }
infer::CompareImplItemObligation { span, .. } => { infer::CompareImplItemObligation { span, .. } => {
RegionOriginNote::Plain { span, msg: fluent::infer::compare_impl_item_obligation } RegionOriginNote::Plain { span, msg: fluent::infer_compare_impl_item_obligation }
.add_to_diagnostic(err); .add_to_diagnostic(err);
} }
infer::CheckAssociatedTypeBounds { ref parent, .. } => { infer::CheckAssociatedTypeBounds { ref parent, .. } => {
@ -80,7 +81,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
infer::AscribeUserTypeProvePredicate(span) => { infer::AscribeUserTypeProvePredicate(span) => {
RegionOriginNote::Plain { RegionOriginNote::Plain {
span, span,
msg: fluent::infer::ascribe_user_type_prove_predicate, msg: fluent::infer_ascribe_user_type_prove_predicate,
} }
.add_to_diagnostic(err); .add_to_diagnostic(err);
} }

View File

@ -5,7 +5,7 @@ use std::io;
use std::path::Path; use std::path::Path;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::ferris_identifier)] #[diag(interface_ferris_identifier)]
pub struct FerrisIdentifier { pub struct FerrisIdentifier {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
@ -14,7 +14,7 @@ pub struct FerrisIdentifier {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::emoji_identifier)] #[diag(interface_emoji_identifier)]
pub struct EmojiIdentifier { pub struct EmojiIdentifier {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
@ -22,67 +22,67 @@ pub struct EmojiIdentifier {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::mixed_bin_crate)] #[diag(interface_mixed_bin_crate)]
pub struct MixedBinCrate; pub struct MixedBinCrate;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::mixed_proc_macro_crate)] #[diag(interface_mixed_proc_macro_crate)]
pub struct MixedProcMacroCrate; pub struct MixedProcMacroCrate;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::proc_macro_doc_without_arg)] #[diag(interface_proc_macro_doc_without_arg)]
pub struct ProcMacroDocWithoutArg; pub struct ProcMacroDocWithoutArg;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::error_writing_dependencies)] #[diag(interface_error_writing_dependencies)]
pub struct ErrorWritingDependencies<'a> { pub struct ErrorWritingDependencies<'a> {
pub path: &'a Path, pub path: &'a Path,
pub error: io::Error, pub error: io::Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::input_file_would_be_overwritten)] #[diag(interface_input_file_would_be_overwritten)]
pub struct InputFileWouldBeOverWritten<'a> { pub struct InputFileWouldBeOverWritten<'a> {
pub path: &'a Path, pub path: &'a Path,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::generated_file_conflicts_with_directory)] #[diag(interface_generated_file_conflicts_with_directory)]
pub struct GeneratedFileConflictsWithDirectory<'a> { pub struct GeneratedFileConflictsWithDirectory<'a> {
pub input_path: &'a Path, pub input_path: &'a Path,
pub dir_path: &'a Path, pub dir_path: &'a Path,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::temps_dir_error)] #[diag(interface_temps_dir_error)]
pub struct TempsDirError; pub struct TempsDirError;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::out_dir_error)] #[diag(interface_out_dir_error)]
pub struct OutDirError; pub struct OutDirError;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::cant_emit_mir)] #[diag(interface_cant_emit_mir)]
pub struct CantEmitMIR { pub struct CantEmitMIR {
pub error: io::Error, pub error: io::Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::rustc_error_fatal)] #[diag(interface_rustc_error_fatal)]
pub struct RustcErrorFatal { pub struct RustcErrorFatal {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::rustc_error_unexpected_annotation)] #[diag(interface_rustc_error_unexpected_annotation)]
pub struct RustcErrorUnexpectedAnnotation { pub struct RustcErrorUnexpectedAnnotation {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(interface::failed_writing_file)] #[diag(interface_failed_writing_file)]
pub struct FailedWritingFile<'a> { pub struct FailedWritingFile<'a> {
pub path: &'a Path, pub path: &'a Path,
pub error: io::Error, pub error: io::Error,

View File

@ -121,25 +121,25 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
cx.struct_span_lint( cx.struct_span_lint(
ARRAY_INTO_ITER, ARRAY_INTO_ITER,
call.ident.span, call.ident.span,
fluent::lint::array_into_iter, fluent::lint_array_into_iter,
|diag| { |diag| {
diag.set_arg("target", target); diag.set_arg("target", target);
diag.span_suggestion( diag.span_suggestion(
call.ident.span, call.ident.span,
fluent::lint::use_iter_suggestion, fluent::use_iter_suggestion,
"iter", "iter",
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
if self.for_expr_span == expr.span { if self.for_expr_span == expr.span {
diag.span_suggestion( diag.span_suggestion(
receiver_arg.span.shrink_to_hi().to(expr.span.shrink_to_hi()), receiver_arg.span.shrink_to_hi().to(expr.span.shrink_to_hi()),
fluent::lint::remove_into_iter_suggestion, fluent::remove_into_iter_suggestion,
"", "",
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
} else if receiver_ty.is_array() { } else if receiver_ty.is_array() {
diag.multipart_suggestion( diag.multipart_suggestion(
fluent::lint::use_explicit_into_iter_suggestion, fluent::use_explicit_into_iter_suggestion,
vec![ vec![
(expr.span.shrink_to_lo(), "IntoIterator::into_iter(".into()), (expr.span.shrink_to_lo(), "IntoIterator::into_iter(".into()),
( (

View File

@ -106,11 +106,11 @@ impl EarlyLintPass for WhileTrue {
cx.struct_span_lint( cx.struct_span_lint(
WHILE_TRUE, WHILE_TRUE,
condition_span, condition_span,
fluent::lint::builtin_while_true, fluent::lint_builtin_while_true,
|lint| { |lint| {
lint.span_suggestion_short( lint.span_suggestion_short(
condition_span, condition_span,
fluent::lint::suggestion, fluent::suggestion,
format!( format!(
"{}loop", "{}loop",
label.map_or_else(String::new, |label| format!( label.map_or_else(String::new, |label| format!(
@ -160,7 +160,7 @@ impl BoxPointers {
cx.struct_span_lint( cx.struct_span_lint(
BOX_POINTERS, BOX_POINTERS,
span, span,
fluent::lint::builtin_box_pointers, fluent::lint_builtin_box_pointers,
|lint| lint.set_arg("ty", ty), |lint| lint.set_arg("ty", ty),
); );
} }
@ -264,13 +264,13 @@ impl<'tcx> LateLintPass<'tcx> for NonShorthandFieldPatterns {
cx.struct_span_lint( cx.struct_span_lint(
NON_SHORTHAND_FIELD_PATTERNS, NON_SHORTHAND_FIELD_PATTERNS,
fieldpat.span, fieldpat.span,
fluent::lint::builtin_non_shorthand_field_patterns, fluent::lint_builtin_non_shorthand_field_patterns,
|lint| { |lint| {
let suggested_ident = let suggested_ident =
format!("{}{}", binding_annot.prefix_str(), ident); format!("{}{}", binding_annot.prefix_str(), ident);
lint.set_arg("ident", ident.clone()).span_suggestion( lint.set_arg("ident", ident.clone()).span_suggestion(
fieldpat.span, fieldpat.span,
fluent::lint::suggestion, fluent::suggestion,
suggested_ident, suggested_ident,
Applicability::MachineApplicable, Applicability::MachineApplicable,
) )
@ -335,7 +335,7 @@ impl UnsafeCode {
msg: DiagnosticMessage, msg: DiagnosticMessage,
) { ) {
self.report_unsafe(cx, span, msg, |lint| { self.report_unsafe(cx, span, msg, |lint| {
lint.note(fluent::lint::builtin_overridden_symbol_name) lint.note(fluent::lint_builtin_overridden_symbol_name)
}) })
} }
@ -346,7 +346,7 @@ impl UnsafeCode {
msg: DiagnosticMessage, msg: DiagnosticMessage,
) { ) {
self.report_unsafe(cx, span, msg, |lint| { self.report_unsafe(cx, span, msg, |lint| {
lint.note(fluent::lint::builtin_overridden_symbol_section) lint.note(fluent::lint_builtin_overridden_symbol_section)
}) })
} }
} }
@ -354,12 +354,9 @@ impl UnsafeCode {
impl EarlyLintPass for UnsafeCode { impl EarlyLintPass for UnsafeCode {
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) { fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
if attr.has_name(sym::allow_internal_unsafe) { if attr.has_name(sym::allow_internal_unsafe) {
self.report_unsafe( self.report_unsafe(cx, attr.span, fluent::lint_builtin_allow_internal_unsafe, |lint| {
cx, lint
attr.span, });
fluent::lint::builtin_allow_internal_unsafe,
|lint| lint,
);
} }
} }
@ -367,7 +364,7 @@ impl EarlyLintPass for UnsafeCode {
if let ast::ExprKind::Block(ref blk, _) = e.kind { if let ast::ExprKind::Block(ref blk, _) = e.kind {
// Don't warn about generated blocks; that'll just pollute the output. // Don't warn about generated blocks; that'll just pollute the output.
if blk.rules == ast::BlockCheckMode::Unsafe(ast::UserProvided) { if blk.rules == ast::BlockCheckMode::Unsafe(ast::UserProvided) {
self.report_unsafe(cx, blk.span, fluent::lint::builtin_unsafe_block, |lint| lint); self.report_unsafe(cx, blk.span, fluent::lint_builtin_unsafe_block, |lint| lint);
} }
} }
} }
@ -375,11 +372,11 @@ impl EarlyLintPass for UnsafeCode {
fn check_item(&mut self, cx: &EarlyContext<'_>, it: &ast::Item) { fn check_item(&mut self, cx: &EarlyContext<'_>, it: &ast::Item) {
match it.kind { match it.kind {
ast::ItemKind::Trait(box ast::Trait { unsafety: ast::Unsafe::Yes(_), .. }) => { ast::ItemKind::Trait(box ast::Trait { unsafety: ast::Unsafe::Yes(_), .. }) => {
self.report_unsafe(cx, it.span, fluent::lint::builtin_unsafe_trait, |lint| lint) self.report_unsafe(cx, it.span, fluent::lint_builtin_unsafe_trait, |lint| lint)
} }
ast::ItemKind::Impl(box ast::Impl { unsafety: ast::Unsafe::Yes(_), .. }) => { ast::ItemKind::Impl(box ast::Impl { unsafety: ast::Unsafe::Yes(_), .. }) => {
self.report_unsafe(cx, it.span, fluent::lint::builtin_unsafe_impl, |lint| lint) self.report_unsafe(cx, it.span, fluent::lint_builtin_unsafe_impl, |lint| lint)
} }
ast::ItemKind::Fn(..) => { ast::ItemKind::Fn(..) => {
@ -387,7 +384,7 @@ impl EarlyLintPass for UnsafeCode {
self.report_overridden_symbol_name( self.report_overridden_symbol_name(
cx, cx,
attr.span, attr.span,
fluent::lint::builtin_no_mangle_fn, fluent::lint_builtin_no_mangle_fn,
); );
} }
@ -395,7 +392,7 @@ impl EarlyLintPass for UnsafeCode {
self.report_overridden_symbol_name( self.report_overridden_symbol_name(
cx, cx,
attr.span, attr.span,
fluent::lint::builtin_export_name_fn, fluent::lint_builtin_export_name_fn,
); );
} }
@ -403,7 +400,7 @@ impl EarlyLintPass for UnsafeCode {
self.report_overridden_symbol_section( self.report_overridden_symbol_section(
cx, cx,
attr.span, attr.span,
fluent::lint::builtin_link_section_fn, fluent::lint_builtin_link_section_fn,
); );
} }
} }
@ -413,7 +410,7 @@ impl EarlyLintPass for UnsafeCode {
self.report_overridden_symbol_name( self.report_overridden_symbol_name(
cx, cx,
attr.span, attr.span,
fluent::lint::builtin_no_mangle_static, fluent::lint_builtin_no_mangle_static,
); );
} }
@ -421,7 +418,7 @@ impl EarlyLintPass for UnsafeCode {
self.report_overridden_symbol_name( self.report_overridden_symbol_name(
cx, cx,
attr.span, attr.span,
fluent::lint::builtin_export_name_static, fluent::lint_builtin_export_name_static,
); );
} }
@ -429,7 +426,7 @@ impl EarlyLintPass for UnsafeCode {
self.report_overridden_symbol_section( self.report_overridden_symbol_section(
cx, cx,
attr.span, attr.span,
fluent::lint::builtin_link_section_static, fluent::lint_builtin_link_section_static,
); );
} }
} }
@ -444,14 +441,14 @@ impl EarlyLintPass for UnsafeCode {
self.report_overridden_symbol_name( self.report_overridden_symbol_name(
cx, cx,
attr.span, attr.span,
fluent::lint::builtin_no_mangle_method, fluent::lint_builtin_no_mangle_method,
); );
} }
if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::export_name) { if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::export_name) {
self.report_overridden_symbol_name( self.report_overridden_symbol_name(
cx, cx,
attr.span, attr.span,
fluent::lint::builtin_export_name_method, fluent::lint_builtin_export_name_method,
); );
} }
} }
@ -469,9 +466,9 @@ impl EarlyLintPass for UnsafeCode {
{ {
let msg = match ctxt { let msg = match ctxt {
FnCtxt::Foreign => return, FnCtxt::Foreign => return,
FnCtxt::Free => fluent::lint::builtin_decl_unsafe_fn, FnCtxt::Free => fluent::lint_builtin_decl_unsafe_fn,
FnCtxt::Assoc(_) if body.is_none() => fluent::lint::builtin_decl_unsafe_method, FnCtxt::Assoc(_) if body.is_none() => fluent::lint_builtin_decl_unsafe_method,
FnCtxt::Assoc(_) => fluent::lint::builtin_impl_unsafe_method, FnCtxt::Assoc(_) => fluent::lint_builtin_impl_unsafe_method,
}; };
self.report_unsafe(cx, span, msg, |lint| lint); self.report_unsafe(cx, span, msg, |lint| lint);
} }
@ -577,7 +574,7 @@ impl MissingDoc {
cx.struct_span_lint( cx.struct_span_lint(
MISSING_DOCS, MISSING_DOCS,
cx.tcx.def_span(def_id), cx.tcx.def_span(def_id),
fluent::lint::builtin_missing_doc, fluent::lint_builtin_missing_doc,
|lint| lint.set_arg("article", article).set_arg("desc", desc), |lint| lint.set_arg("article", article).set_arg("desc", desc),
); );
} }
@ -769,7 +766,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
cx.struct_span_lint( cx.struct_span_lint(
MISSING_COPY_IMPLEMENTATIONS, MISSING_COPY_IMPLEMENTATIONS,
item.span, item.span,
fluent::lint::builtin_missing_copy_impl, fluent::lint_builtin_missing_copy_impl,
|lint| lint, |lint| lint,
) )
} }
@ -848,7 +845,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
cx.struct_span_lint( cx.struct_span_lint(
MISSING_DEBUG_IMPLEMENTATIONS, MISSING_DEBUG_IMPLEMENTATIONS,
item.span, item.span,
fluent::lint::builtin_missing_debug_impl, fluent::lint_builtin_missing_debug_impl,
|lint| lint.set_arg("debug", cx.tcx.def_path_str(debug)), |lint| lint.set_arg("debug", cx.tcx.def_path_str(debug)),
); );
} }
@ -928,11 +925,11 @@ impl EarlyLintPass for AnonymousParameters {
cx.struct_span_lint( cx.struct_span_lint(
ANONYMOUS_PARAMETERS, ANONYMOUS_PARAMETERS,
arg.pat.span, arg.pat.span,
fluent::lint::builtin_anonymous_params, fluent::lint_builtin_anonymous_params,
|lint| { |lint| {
lint.span_suggestion( lint.span_suggestion(
arg.pat.span, arg.pat.span,
fluent::lint::suggestion, fluent::suggestion,
format!("_: {}", ty_snip), format!("_: {}", ty_snip),
appl, appl,
) )
@ -976,7 +973,7 @@ impl EarlyLintPass for DeprecatedAttr {
cx.struct_span_lint( cx.struct_span_lint(
DEPRECATED, DEPRECATED,
attr.span, attr.span,
fluent::lint::builtin_deprecated_attr_link, fluent::lint_builtin_deprecated_attr_link,
|lint| { |lint| {
lint.set_arg("name", name) lint.set_arg("name", name)
.set_arg("reason", reason) .set_arg("reason", reason)
@ -984,7 +981,7 @@ impl EarlyLintPass for DeprecatedAttr {
.span_suggestion_short( .span_suggestion_short(
attr.span, attr.span,
suggestion.map(|s| s.into()).unwrap_or( suggestion.map(|s| s.into()).unwrap_or(
fluent::lint::builtin_deprecated_attr_default_suggestion, fluent::lint_builtin_deprecated_attr_default_suggestion,
), ),
"", "",
Applicability::MachineApplicable, Applicability::MachineApplicable,
@ -999,12 +996,12 @@ impl EarlyLintPass for DeprecatedAttr {
cx.struct_span_lint( cx.struct_span_lint(
DEPRECATED, DEPRECATED,
attr.span, attr.span,
fluent::lint::builtin_deprecated_attr_used, fluent::lint_builtin_deprecated_attr_used,
|lint| { |lint| {
lint.set_arg("name", pprust::path_to_string(&attr.get_normal_item().path)) lint.set_arg("name", pprust::path_to_string(&attr.get_normal_item().path))
.span_suggestion_short( .span_suggestion_short(
attr.span, attr.span,
fluent::lint::builtin_deprecated_attr_default_suggestion, fluent::lint_builtin_deprecated_attr_default_suggestion,
"", "",
Applicability::MachineApplicable, Applicability::MachineApplicable,
) )
@ -1039,14 +1036,14 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
cx.struct_span_lint( cx.struct_span_lint(
UNUSED_DOC_COMMENTS, UNUSED_DOC_COMMENTS,
span, span,
fluent::lint::builtin_unused_doc_comment, fluent::lint_builtin_unused_doc_comment,
|lint| { |lint| {
lint.set_arg("kind", node_kind).span_label(node_span, fluent::lint::label).help( lint.set_arg("kind", node_kind).span_label(node_span, fluent::label).help(
match attr.kind { match attr.kind {
AttrKind::DocComment(CommentKind::Line, _) | AttrKind::Normal(..) => { AttrKind::DocComment(CommentKind::Line, _) | AttrKind::Normal(..) => {
fluent::lint::plain_help fluent::plain_help
} }
AttrKind::DocComment(CommentKind::Block, _) => fluent::lint::block_help, AttrKind::DocComment(CommentKind::Block, _) => fluent::block_help,
}, },
) )
}, },
@ -1167,11 +1164,11 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
cx.struct_span_lint( cx.struct_span_lint(
NO_MANGLE_GENERIC_ITEMS, NO_MANGLE_GENERIC_ITEMS,
span, span,
fluent::lint::builtin_no_mangle_generic, fluent::lint_builtin_no_mangle_generic,
|lint| { |lint| {
lint.span_suggestion_short( lint.span_suggestion_short(
no_mangle_attr.span, no_mangle_attr.span,
fluent::lint::suggestion, fluent::suggestion,
"", "",
// Use of `#[no_mangle]` suggests FFI intent; correct // Use of `#[no_mangle]` suggests FFI intent; correct
// fix may be to monomorphize source by hand // fix may be to monomorphize source by hand
@ -1197,7 +1194,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
cx.struct_span_lint( cx.struct_span_lint(
NO_MANGLE_CONST_ITEMS, NO_MANGLE_CONST_ITEMS,
it.span, it.span,
fluent::lint::builtin_const_no_mangle, fluent::lint_builtin_const_no_mangle,
|lint| { |lint| {
// account for "pub const" (#45562) // account for "pub const" (#45562)
let start = cx let start = cx
@ -1211,7 +1208,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
let const_span = it.span.with_hi(BytePos(it.span.lo().0 + start + 5)); let const_span = it.span.with_hi(BytePos(it.span.lo().0 + start + 5));
lint.span_suggestion( lint.span_suggestion(
const_span, const_span,
fluent::lint::suggestion, fluent::suggestion,
"pub static", "pub static",
Applicability::MachineApplicable, Applicability::MachineApplicable,
) )
@ -1279,7 +1276,7 @@ impl<'tcx> LateLintPass<'tcx> for MutableTransmutes {
cx.struct_span_lint( cx.struct_span_lint(
MUTABLE_TRANSMUTES, MUTABLE_TRANSMUTES,
expr.span, expr.span,
fluent::lint::builtin_mutable_transmutes, fluent::lint_builtin_mutable_transmutes,
|lint| lint, |lint| lint,
); );
} }
@ -1332,7 +1329,7 @@ impl<'tcx> LateLintPass<'tcx> for UnstableFeatures {
cx.struct_span_lint( cx.struct_span_lint(
UNSTABLE_FEATURES, UNSTABLE_FEATURES,
item.span(), item.span(),
fluent::lint::builtin_unstable_features, fluent::lint_builtin_unstable_features,
|lint| lint, |lint| lint,
); );
} }
@ -1396,18 +1393,13 @@ impl UnreachablePub {
cx.struct_span_lint( cx.struct_span_lint(
UNREACHABLE_PUB, UNREACHABLE_PUB,
def_span, def_span,
fluent::lint::builtin_unreachable_pub, fluent::lint_builtin_unreachable_pub,
|lint| { |lint| {
lint.set_arg("what", what); lint.set_arg("what", what);
lint.span_suggestion( lint.span_suggestion(vis_span, fluent::suggestion, "pub(crate)", applicability);
vis_span,
fluent::lint::suggestion,
"pub(crate)",
applicability,
);
if exportable { if exportable {
lint.help(fluent::lint::help); lint.help(fluent::help);
} }
lint lint
}, },
@ -1498,7 +1490,7 @@ impl TypeAliasBounds {
impl Visitor<'_> for WalkAssocTypes<'_> { impl Visitor<'_> for WalkAssocTypes<'_> {
fn visit_qpath(&mut self, qpath: &hir::QPath<'_>, id: hir::HirId, span: Span) { fn visit_qpath(&mut self, qpath: &hir::QPath<'_>, id: hir::HirId, span: Span) {
if TypeAliasBounds::is_type_variable_assoc(qpath) { if TypeAliasBounds::is_type_variable_assoc(qpath) {
self.err.span_help(span, fluent::lint::builtin_type_alias_bounds_help); self.err.span_help(span, fluent::lint_builtin_type_alias_bounds_help);
} }
intravisit::walk_qpath(self, qpath, id) intravisit::walk_qpath(self, qpath, id)
} }
@ -1541,11 +1533,11 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
let mut suggested_changing_assoc_types = false; let mut suggested_changing_assoc_types = false;
if !where_spans.is_empty() { if !where_spans.is_empty() {
cx.lint(TYPE_ALIAS_BOUNDS, fluent::lint::builtin_type_alias_where_clause, |lint| { cx.lint(TYPE_ALIAS_BOUNDS, fluent::lint_builtin_type_alias_where_clause, |lint| {
lint.set_span(where_spans); lint.set_span(where_spans);
lint.span_suggestion( lint.span_suggestion(
type_alias_generics.where_clause_span, type_alias_generics.where_clause_span,
fluent::lint::suggestion, fluent::suggestion,
"", "",
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
@ -1558,10 +1550,10 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
} }
if !inline_spans.is_empty() { if !inline_spans.is_empty() {
cx.lint(TYPE_ALIAS_BOUNDS, fluent::lint::builtin_type_alias_generic_bounds, |lint| { cx.lint(TYPE_ALIAS_BOUNDS, fluent::lint_builtin_type_alias_generic_bounds, |lint| {
lint.set_span(inline_spans); lint.set_span(inline_spans);
lint.multipart_suggestion( lint.multipart_suggestion(
fluent::lint::suggestion, fluent::suggestion,
inline_sugg, inline_sugg,
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
@ -1670,7 +1662,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
cx.struct_span_lint( cx.struct_span_lint(
TRIVIAL_BOUNDS, TRIVIAL_BOUNDS,
span, span,
fluent::lint::builtin_trivial_bounds, fluent::lint_builtin_trivial_bounds,
|lint| { |lint| {
lint.set_arg("predicate_kind_name", predicate_kind_name) lint.set_arg("predicate_kind_name", predicate_kind_name)
.set_arg("predicate", predicate) .set_arg("predicate", predicate)
@ -1775,8 +1767,8 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
}; };
if let Some((start, end, join)) = endpoints { if let Some((start, end, join)) = endpoints {
let msg = fluent::lint::builtin_ellipsis_inclusive_range_patterns; let msg = fluent::lint_builtin_ellipsis_inclusive_range_patterns;
let suggestion = fluent::lint::suggestion; let suggestion = fluent::suggestion;
if parenthesise { if parenthesise {
self.node_id = Some(pat.id); self.node_id = Some(pat.id);
let end = expr_to_string(&end); let end = expr_to_string(&end);
@ -1899,7 +1891,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnameableTestItems {
cx.struct_span_lint( cx.struct_span_lint(
UNNAMEABLE_TEST_ITEMS, UNNAMEABLE_TEST_ITEMS,
attr.span, attr.span,
fluent::lint::builtin_unnameable_test_items, fluent::lint_builtin_unnameable_test_items,
|lint| lint, |lint| lint,
); );
} }
@ -2020,11 +2012,11 @@ impl KeywordIdents {
cx.struct_span_lint( cx.struct_span_lint(
KEYWORD_IDENTS, KEYWORD_IDENTS,
ident.span, ident.span,
fluent::lint::builtin_keyword_idents, fluent::lint_builtin_keyword_idents,
|lint| { |lint| {
lint.set_arg("kw", ident.clone()).set_arg("next", next_edition).span_suggestion( lint.set_arg("kw", ident.clone()).set_arg("next", next_edition).span_suggestion(
ident.span, ident.span,
fluent::lint::suggestion, fluent::suggestion,
format!("r#{}", ident), format!("r#{}", ident),
Applicability::MachineApplicable, Applicability::MachineApplicable,
) )
@ -2283,10 +2275,10 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
cx.struct_span_lint( cx.struct_span_lint(
EXPLICIT_OUTLIVES_REQUIREMENTS, EXPLICIT_OUTLIVES_REQUIREMENTS,
lint_spans.clone(), lint_spans.clone(),
fluent::lint::builtin_explicit_outlives, fluent::lint_builtin_explicit_outlives,
|lint| { |lint| {
lint.set_arg("count", bound_count).multipart_suggestion( lint.set_arg("count", bound_count).multipart_suggestion(
fluent::lint::suggestion, fluent::suggestion,
lint_spans lint_spans
.into_iter() .into_iter()
.map(|span| (span, String::new())) .map(|span| (span, String::new()))
@ -2344,17 +2336,17 @@ impl EarlyLintPass for IncompleteFeatures {
cx.struct_span_lint( cx.struct_span_lint(
INCOMPLETE_FEATURES, INCOMPLETE_FEATURES,
span, span,
fluent::lint::builtin_incomplete_features, fluent::lint_builtin_incomplete_features,
|lint| { |lint| {
lint.set_arg("name", name); lint.set_arg("name", name);
if let Some(n) = if let Some(n) =
rustc_feature::find_feature_issue(name, GateIssue::Language) rustc_feature::find_feature_issue(name, GateIssue::Language)
{ {
lint.set_arg("n", n); lint.set_arg("n", n);
lint.note(fluent::lint::note); lint.note(fluent::note);
} }
if HAS_MIN_FEATURES.contains(&name) { if HAS_MIN_FEATURES.contains(&name) {
lint.help(fluent::lint::help); lint.help(fluent::help);
} }
lint lint
}, },
@ -3015,9 +3007,9 @@ impl<'tcx> LateLintPass<'tcx> for ClashingExternDeclarations {
// Finally, emit the diagnostic. // Finally, emit the diagnostic.
let msg = if orig.get_name() == this_fi.ident.name { let msg = if orig.get_name() == this_fi.ident.name {
fluent::lint::builtin_clashing_extern_same_name fluent::lint_builtin_clashing_extern_same_name
} else { } else {
fluent::lint::builtin_clashing_extern_diff_name fluent::lint_builtin_clashing_extern_diff_name
}; };
tcx.struct_span_lint_hir( tcx.struct_span_lint_hir(
CLASHING_EXTERN_DECLARATIONS, CLASHING_EXTERN_DECLARATIONS,
@ -3032,14 +3024,8 @@ impl<'tcx> LateLintPass<'tcx> for ClashingExternDeclarations {
lint.set_arg("this_fi", this_fi.ident.name) lint.set_arg("this_fi", this_fi.ident.name)
.set_arg("orig", orig.get_name()) .set_arg("orig", orig.get_name())
.span_label( .span_label(get_relevant_span(orig_fi), fluent::previous_decl_label)
get_relevant_span(orig_fi), .span_label(get_relevant_span(this_fi), fluent::mismatch_label)
fluent::lint::previous_decl_label,
)
.span_label(
get_relevant_span(this_fi),
fluent::lint::mismatch_label,
)
// FIXME(davidtwco): translatable expected/found // FIXME(davidtwco): translatable expected/found
.note_expected_found(&"", expected_str, &"", found_str) .note_expected_found(&"", expected_str, &"", found_str)
}, },
@ -3125,8 +3111,8 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
cx.struct_span_lint( cx.struct_span_lint(
DEREF_NULLPTR, DEREF_NULLPTR,
expr.span, expr.span,
fluent::lint::builtin_deref_nullptr, fluent::lint_builtin_deref_nullptr,
|lint| lint.span_label(expr.span, fluent::lint::label), |lint| lint.span_label(expr.span, fluent::label),
); );
} }
} }
@ -3238,7 +3224,7 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
cx.lookup_with_diagnostics( cx.lookup_with_diagnostics(
NAMED_ASM_LABELS, NAMED_ASM_LABELS,
Some(target_spans), Some(target_spans),
fluent::lint::builtin_asm_labels, fluent::lint_builtin_asm_labels,
|lint| lint, |lint| lint,
BuiltinLintDiagnostics::NamedAsmLabel( BuiltinLintDiagnostics::NamedAsmLabel(
"only local labels of the form `<number>:` should be used in inline asm" "only local labels of the form `<number>:` should be used in inline asm"
@ -3341,8 +3327,8 @@ impl EarlyLintPass for UnexpectedCfgs {
cx.lookup( cx.lookup(
UNEXPECTED_CFGS, UNEXPECTED_CFGS,
None::<MultiSpan>, None::<MultiSpan>,
fluent::lint::builtin_unexpected_cli_config_name, fluent::lint_builtin_unexpected_cli_config_name,
|diag| diag.help(fluent::lint::help).set_arg("name", name), |diag| diag.help(fluent::help).set_arg("name", name),
); );
} }
} }
@ -3352,9 +3338,9 @@ impl EarlyLintPass for UnexpectedCfgs {
cx.lookup( cx.lookup(
UNEXPECTED_CFGS, UNEXPECTED_CFGS,
None::<MultiSpan>, None::<MultiSpan>,
fluent::lint::builtin_unexpected_cli_config_value, fluent::lint_builtin_unexpected_cli_config_value,
|diag| { |diag| {
diag.help(fluent::lint::help) diag.help(fluent::help)
.set_arg("name", name) .set_arg("name", name)
.set_arg("value", value) .set_arg("value", value)
}, },

View File

@ -53,8 +53,8 @@ fn enforce_mem_discriminant(
cx.struct_span_lint( cx.struct_span_lint(
ENUM_INTRINSICS_NON_ENUMS, ENUM_INTRINSICS_NON_ENUMS,
expr_span, expr_span,
fluent::lint::enum_intrinsics_mem_discriminant, fluent::lint_enum_intrinsics_mem_discriminant,
|lint| lint.set_arg("ty_param", ty_param).span_note(args_span, fluent::lint::note), |lint| lint.set_arg("ty_param", ty_param).span_note(args_span, fluent::note),
); );
} }
} }
@ -65,8 +65,8 @@ fn enforce_mem_variant_count(cx: &LateContext<'_>, func_expr: &hir::Expr<'_>, sp
cx.struct_span_lint( cx.struct_span_lint(
ENUM_INTRINSICS_NON_ENUMS, ENUM_INTRINSICS_NON_ENUMS,
span, span,
fluent::lint::enum_intrinsics_mem_variant, fluent::lint_enum_intrinsics_mem_variant,
|lint| lint.set_arg("ty_param", ty_param).note(fluent::lint::note), |lint| lint.set_arg("ty_param", ty_param).note(fluent::note),
); );
} }
} }

View File

@ -7,7 +7,7 @@ use rustc_session::lint::Level;
use rustc_span::{Span, Symbol}; use rustc_span::{Span, Symbol};
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(lint::overruled_attribute, code = "E0453")] #[diag(lint_overruled_attribute, code = "E0453")]
pub struct OverruledAttribute { pub struct OverruledAttribute {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -32,24 +32,24 @@ impl AddToDiagnostic for OverruledAttributeSub {
{ {
match self { match self {
OverruledAttributeSub::DefaultSource { id } => { OverruledAttributeSub::DefaultSource { id } => {
diag.note(fluent::lint::default_source); diag.note(fluent::lint_default_source);
diag.set_arg("id", id); diag.set_arg("id", id);
} }
OverruledAttributeSub::NodeSource { span, reason } => { OverruledAttributeSub::NodeSource { span, reason } => {
diag.span_label(span, fluent::lint::node_source); diag.span_label(span, fluent::lint_node_source);
if let Some(rationale) = reason { if let Some(rationale) = reason {
diag.note(rationale.as_str()); diag.note(rationale.as_str());
} }
} }
OverruledAttributeSub::CommandLineSource => { OverruledAttributeSub::CommandLineSource => {
diag.note(fluent::lint::command_line_source); diag.note(fluent::lint_command_line_source);
} }
} }
} }
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(lint::malformed_attribute, code = "E0452")] #[diag(lint_malformed_attribute, code = "E0452")]
pub struct MalformedAttribute { pub struct MalformedAttribute {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -59,16 +59,16 @@ pub struct MalformedAttribute {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum MalformedAttributeSub { pub enum MalformedAttributeSub {
#[label(lint::bad_attribute_argument)] #[label(lint_bad_attribute_argument)]
BadAttributeArgument(#[primary_span] Span), BadAttributeArgument(#[primary_span] Span),
#[label(lint::reason_must_be_string_literal)] #[label(lint_reason_must_be_string_literal)]
ReasonMustBeStringLiteral(#[primary_span] Span), ReasonMustBeStringLiteral(#[primary_span] Span),
#[label(lint::reason_must_come_last)] #[label(lint_reason_must_come_last)]
ReasonMustComeLast(#[primary_span] Span), ReasonMustComeLast(#[primary_span] Span),
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(lint::unknown_tool_in_scoped_lint, code = "E0710")] #[diag(lint_unknown_tool_in_scoped_lint, code = "E0710")]
pub struct UnknownToolInScopedLint { pub struct UnknownToolInScopedLint {
#[primary_span] #[primary_span]
pub span: Option<Span>, pub span: Option<Span>,
@ -79,7 +79,7 @@ pub struct UnknownToolInScopedLint {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(lint::builtin_ellipsis_inclusive_range_patterns, code = "E0783")] #[diag(lint_builtin_ellipsis_inclusive_range_patterns, code = "E0783")]
pub struct BuiltinEllpisisInclusiveRangePatterns { pub struct BuiltinEllpisisInclusiveRangePatterns {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -89,14 +89,14 @@ pub struct BuiltinEllpisisInclusiveRangePatterns {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(lint::requested_level)] #[note(lint_requested_level)]
pub struct RequestedLevel { pub struct RequestedLevel {
pub level: Level, pub level: Level,
pub lint_name: String, pub lint_name: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(lint::unsupported_group, code = "E0602")] #[diag(lint_unsupported_group, code = "E0602")]
pub struct UnsupportedGroup { pub struct UnsupportedGroup {
pub lint_group: String, pub lint_group: String,
} }
@ -112,10 +112,10 @@ impl IntoDiagnostic<'_> for CheckNameUnknown {
self, self,
handler: &Handler, handler: &Handler,
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> { ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
let mut diag = handler.struct_err(fluent::lint::check_name_unknown); let mut diag = handler.struct_err(fluent::lint_check_name_unknown);
diag.code(rustc_errors::error_code!(E0602)); diag.code(rustc_errors::error_code!(E0602));
if let Some(suggestion) = self.suggestion { if let Some(suggestion) = self.suggestion {
diag.help(fluent::lint::help); diag.help(fluent::help);
diag.set_arg("suggestion", suggestion); diag.set_arg("suggestion", suggestion);
} }
diag.set_arg("lint_name", self.lint_name); diag.set_arg("lint_name", self.lint_name);
@ -125,7 +125,7 @@ impl IntoDiagnostic<'_> for CheckNameUnknown {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(lint::check_name_unknown_tool, code = "E0602")] #[diag(lint_check_name_unknown_tool, code = "E0602")]
pub struct CheckNameUnknownTool { pub struct CheckNameUnknownTool {
pub tool_name: Symbol, pub tool_name: Symbol,
#[subdiagnostic] #[subdiagnostic]
@ -133,7 +133,7 @@ pub struct CheckNameUnknownTool {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(lint::check_name_warning)] #[diag(lint_check_name_warning)]
pub struct CheckNameWarning { pub struct CheckNameWarning {
pub msg: String, pub msg: String,
#[subdiagnostic] #[subdiagnostic]
@ -141,7 +141,7 @@ pub struct CheckNameWarning {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(lint::check_name_deprecated)] #[diag(lint_check_name_deprecated)]
pub struct CheckNameDeprecated { pub struct CheckNameDeprecated {
pub lint_name: String, pub lint_name: String,
pub new_name: String, pub new_name: String,

View File

@ -45,14 +45,14 @@ fn emit_unfulfilled_expectation_lint(
builtin::UNFULFILLED_LINT_EXPECTATIONS, builtin::UNFULFILLED_LINT_EXPECTATIONS,
hir_id, hir_id,
expectation.emission_span, expectation.emission_span,
fluent::lint::expectation, fluent::lint_expectation,
|lint| { |lint| {
if let Some(rationale) = expectation.reason { if let Some(rationale) = expectation.reason {
lint.note(rationale.as_str()); lint.note(rationale.as_str());
} }
if expectation.is_unfulfilled_lint_expectations { if expectation.is_unfulfilled_lint_expectations {
lint.note(fluent::lint::note); lint.note(fluent::note);
} }
lint lint

View File

@ -63,12 +63,12 @@ impl HiddenUnicodeCodepoints {
cx.struct_span_lint( cx.struct_span_lint(
TEXT_DIRECTION_CODEPOINT_IN_LITERAL, TEXT_DIRECTION_CODEPOINT_IN_LITERAL,
span, span,
fluent::lint::hidden_unicode_codepoints, fluent::lint_hidden_unicode_codepoints,
|lint| { |lint| {
lint.set_arg("label", label); lint.set_arg("label", label);
lint.set_arg("count", spans.len()); lint.set_arg("count", spans.len());
lint.span_label(span, fluent::lint::label); lint.span_label(span, fluent::label);
lint.note(fluent::lint::note); lint.note(fluent::note);
if point_at_inner_spans { if point_at_inner_spans {
for (c, span) in &spans { for (c, span) in &spans {
lint.span_label(*span, format!("{:?}", c)); lint.span_label(*span, format!("{:?}", c));
@ -76,13 +76,13 @@ impl HiddenUnicodeCodepoints {
} }
if point_at_inner_spans && !spans.is_empty() { if point_at_inner_spans && !spans.is_empty() {
lint.multipart_suggestion_with_style( lint.multipart_suggestion_with_style(
fluent::lint::suggestion_remove, fluent::suggestion_remove,
spans.iter().map(|(_, span)| (*span, "".to_string())).collect(), spans.iter().map(|(_, span)| (*span, "".to_string())).collect(),
Applicability::MachineApplicable, Applicability::MachineApplicable,
SuggestionStyle::HideCodeAlways, SuggestionStyle::HideCodeAlways,
); );
lint.multipart_suggestion( lint.multipart_suggestion(
fluent::lint::suggestion_escape, fluent::suggestion_escape,
spans spans
.into_iter() .into_iter()
.map(|(c, span)| { .map(|(c, span)| {
@ -104,8 +104,8 @@ impl HiddenUnicodeCodepoints {
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join(", "), .join(", "),
); );
lint.note(fluent::lint::suggestion_remove); lint.note(fluent::suggestion_remove);
lint.note(fluent::lint::no_suggestion_note_escape); lint.note(fluent::no_suggestion_note_escape);
} }
lint lint
}, },

View File

@ -37,11 +37,11 @@ impl LateLintPass<'_> for DefaultHashTypes {
cx.struct_span_lint( cx.struct_span_lint(
DEFAULT_HASH_TYPES, DEFAULT_HASH_TYPES,
path.span, path.span,
fluent::lint::default_hash_types, fluent::lint_default_hash_types,
|lint| { |lint| {
lint.set_arg("preferred", replace) lint.set_arg("preferred", replace)
.set_arg("used", cx.tcx.item_name(def_id)) .set_arg("used", cx.tcx.item_name(def_id))
.note(fluent::lint::note) .note(fluent::note)
}, },
); );
} }
@ -86,8 +86,8 @@ impl LateLintPass<'_> for QueryStability {
cx.struct_span_lint( cx.struct_span_lint(
POTENTIAL_QUERY_INSTABILITY, POTENTIAL_QUERY_INSTABILITY,
span, span,
fluent::lint::query_instability, fluent::lint_query_instability,
|lint| lint.set_arg("query", cx.tcx.item_name(def_id)).note(fluent::lint::note), |lint| lint.set_arg("query", cx.tcx.item_name(def_id)).note(fluent::note),
) )
} }
} }
@ -126,11 +126,11 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
let span = path.span.with_hi( let span = path.span.with_hi(
segment.args.map_or(segment.ident.span, |a| a.span_ext).hi() segment.args.map_or(segment.ident.span, |a| a.span_ext).hi()
); );
cx.struct_span_lint(USAGE_OF_TY_TYKIND, path.span, fluent::lint::tykind_kind, |lint| { cx.struct_span_lint(USAGE_OF_TY_TYKIND, path.span, fluent::lint_tykind_kind, |lint| {
lint lint
.span_suggestion( .span_suggestion(
span, span,
fluent::lint::suggestion, fluent::suggestion,
"ty", "ty",
Applicability::MaybeIncorrect, // ty maybe needs an import Applicability::MaybeIncorrect, // ty maybe needs an import
) )
@ -193,10 +193,10 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
cx.struct_span_lint( cx.struct_span_lint(
USAGE_OF_TY_TYKIND, USAGE_OF_TY_TYKIND,
path.span, path.span,
fluent::lint::tykind_kind, fluent::lint_tykind_kind,
|lint| lint.span_suggestion( |lint| lint.span_suggestion(
span, span,
fluent::lint::suggestion, fluent::suggestion,
"ty", "ty",
Applicability::MaybeIncorrect, // ty maybe needs an import Applicability::MaybeIncorrect, // ty maybe needs an import
) )
@ -205,18 +205,18 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
None => cx.struct_span_lint( None => cx.struct_span_lint(
USAGE_OF_TY_TYKIND, USAGE_OF_TY_TYKIND,
path.span, path.span,
fluent::lint::tykind, fluent::lint_tykind,
|lint| lint.help(fluent::lint::help) |lint| lint.help(fluent::help)
) )
} }
} else if !ty.span.from_expansion() && let Some(t) = is_ty_or_ty_ctxt(cx, &path) { } else if !ty.span.from_expansion() && let Some(t) = is_ty_or_ty_ctxt(cx, &path) {
if path.segments.len() > 1 { if path.segments.len() > 1 {
cx.struct_span_lint(USAGE_OF_QUALIFIED_TY, path.span, fluent::lint::ty_qualified, |lint| { cx.struct_span_lint(USAGE_OF_QUALIFIED_TY, path.span, fluent::lint_ty_qualified, |lint| {
lint lint
.set_arg("ty", t.clone()) .set_arg("ty", t.clone())
.span_suggestion( .span_suggestion(
path.span, path.span,
fluent::lint::suggestion, fluent::suggestion,
t, t,
// The import probably needs to be changed // The import probably needs to be changed
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
@ -310,8 +310,8 @@ impl EarlyLintPass for LintPassImpl {
cx.struct_span_lint( cx.struct_span_lint(
LINT_PASS_IMPL_WITHOUT_MACRO, LINT_PASS_IMPL_WITHOUT_MACRO,
lint_pass.path.span, lint_pass.path.span,
fluent::lint::lintpass_by_hand, fluent::lint_lintpass_by_hand,
|lint| lint.help(fluent::lint::help), |lint| lint.help(fluent::help),
) )
} }
} }
@ -351,8 +351,8 @@ impl<'tcx> LateLintPass<'tcx> for ExistingDocKeyword {
cx.struct_span_lint( cx.struct_span_lint(
EXISTING_DOC_KEYWORD, EXISTING_DOC_KEYWORD,
attr.span, attr.span,
fluent::lint::non_existant_doc_keyword, fluent::lint_non_existant_doc_keyword,
|lint| lint.set_arg("keyword", v).help(fluent::lint::help), |lint| lint.set_arg("keyword", v).help(fluent::help),
); );
} }
} }
@ -414,7 +414,7 @@ impl LateLintPass<'_> for Diagnostics {
cx.struct_span_lint( cx.struct_span_lint(
DIAGNOSTIC_OUTSIDE_OF_IMPL, DIAGNOSTIC_OUTSIDE_OF_IMPL,
span, span,
fluent::lint::diag_out_of_impl, fluent::lint_diag_out_of_impl,
|lint| lint, |lint| lint,
) )
} }
@ -435,7 +435,7 @@ impl LateLintPass<'_> for Diagnostics {
cx.struct_span_lint( cx.struct_span_lint(
UNTRANSLATABLE_DIAGNOSTIC, UNTRANSLATABLE_DIAGNOSTIC,
span, span,
fluent::lint::untranslatable_diag, fluent::lint_untranslatable_diag,
|lint| lint, |lint| lint,
) )
} }

View File

@ -93,12 +93,12 @@ fn lint_cstring_as_ptr(
cx.struct_span_lint( cx.struct_span_lint(
TEMPORARY_CSTRING_AS_PTR, TEMPORARY_CSTRING_AS_PTR,
as_ptr_span, as_ptr_span,
fluent::lint::cstring_ptr, fluent::lint_cstring_ptr,
|diag| { |diag| {
diag.span_label(as_ptr_span, fluent::lint::as_ptr_label) diag.span_label(as_ptr_span, fluent::as_ptr_label)
.span_label(unwrap.span, fluent::lint::unwrap_label) .span_label(unwrap.span, fluent::unwrap_label)
.note(fluent::lint::note) .note(fluent::note)
.help(fluent::lint::help) .help(fluent::help)
}, },
); );
} }

View File

@ -183,7 +183,7 @@ impl EarlyLintPass for NonAsciiIdents {
cx.struct_span_lint( cx.struct_span_lint(
NON_ASCII_IDENTS, NON_ASCII_IDENTS,
sp, sp,
fluent::lint::identifier_non_ascii_char, fluent::lint_identifier_non_ascii_char,
|lint| lint, |lint| lint,
); );
if check_uncommon_codepoints if check_uncommon_codepoints
@ -192,7 +192,7 @@ impl EarlyLintPass for NonAsciiIdents {
cx.struct_span_lint( cx.struct_span_lint(
UNCOMMON_CODEPOINTS, UNCOMMON_CODEPOINTS,
sp, sp,
fluent::lint::identifier_uncommon_codepoints, fluent::lint_identifier_uncommon_codepoints,
|lint| lint, |lint| lint,
) )
} }
@ -225,11 +225,11 @@ impl EarlyLintPass for NonAsciiIdents {
cx.struct_span_lint( cx.struct_span_lint(
CONFUSABLE_IDENTS, CONFUSABLE_IDENTS,
sp, sp,
fluent::lint::confusable_identifier_pair, fluent::lint_confusable_identifier_pair,
|lint| { |lint| {
lint.set_arg("existing_sym", *existing_symbol) lint.set_arg("existing_sym", *existing_symbol)
.set_arg("sym", symbol) .set_arg("sym", symbol)
.span_label(*existing_span, fluent::lint::label) .span_label(*existing_span, fluent::label)
}, },
); );
} }
@ -334,7 +334,7 @@ impl EarlyLintPass for NonAsciiIdents {
cx.struct_span_lint( cx.struct_span_lint(
MIXED_SCRIPT_CONFUSABLES, MIXED_SCRIPT_CONFUSABLES,
sp, sp,
fluent::lint::mixed_script_confusables, fluent::lint_mixed_script_confusables,
|lint| { |lint| {
let mut includes = String::new(); let mut includes = String::new();
for (idx, ch) in ch_list.into_iter().enumerate() { for (idx, ch) in ch_list.into_iter().enumerate() {
@ -346,8 +346,8 @@ impl EarlyLintPass for NonAsciiIdents {
} }
lint.set_arg("set", script_set.to_string()) lint.set_arg("set", script_set.to_string())
.set_arg("includes", includes) .set_arg("includes", includes)
.note(fluent::lint::includes_note) .note(fluent::includes_note)
.note(fluent::lint::note) .note(fluent::note)
}, },
); );
} }

View File

@ -119,20 +119,20 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
arg_span = expn.call_site; arg_span = expn.call_site;
} }
cx.struct_span_lint(NON_FMT_PANICS, arg_span, fluent::lint::non_fmt_panic, |lint| { cx.struct_span_lint(NON_FMT_PANICS, arg_span, fluent::lint_non_fmt_panic, |lint| {
lint.set_arg("name", symbol); lint.set_arg("name", symbol);
lint.note(fluent::lint::note); lint.note(fluent::note);
lint.note(fluent::lint::more_info_note); lint.note(fluent::more_info_note);
if !is_arg_inside_call(arg_span, span) { if !is_arg_inside_call(arg_span, span) {
// No clue where this argument is coming from. // No clue where this argument is coming from.
return lint; return lint;
} }
if arg_macro.map_or(false, |id| cx.tcx.is_diagnostic_item(sym::format_macro, id)) { if arg_macro.map_or(false, |id| cx.tcx.is_diagnostic_item(sym::format_macro, id)) {
// A case of `panic!(format!(..))`. // A case of `panic!(format!(..))`.
lint.note(fluent::lint::supports_fmt_note); lint.note(fluent::supports_fmt_note);
if let Some((open, close, _)) = find_delimiters(cx, arg_span) { if let Some((open, close, _)) = find_delimiters(cx, arg_span) {
lint.multipart_suggestion( lint.multipart_suggestion(
fluent::lint::supports_fmt_suggestion, fluent::supports_fmt_suggestion,
vec![ vec![
(arg_span.until(open.shrink_to_hi()), "".into()), (arg_span.until(open.shrink_to_hi()), "".into()),
(close.until(arg_span.shrink_to_hi()), "".into()), (close.until(arg_span.shrink_to_hi()), "".into()),
@ -178,7 +178,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
if suggest_display { if suggest_display {
lint.span_suggestion_verbose( lint.span_suggestion_verbose(
arg_span.shrink_to_lo(), arg_span.shrink_to_lo(),
fluent::lint::display_suggestion, fluent::display_suggestion,
"\"{}\", ", "\"{}\", ",
fmt_applicability, fmt_applicability,
); );
@ -186,7 +186,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
lint.set_arg("ty", ty); lint.set_arg("ty", ty);
lint.span_suggestion_verbose( lint.span_suggestion_verbose(
arg_span.shrink_to_lo(), arg_span.shrink_to_lo(),
fluent::lint::debug_suggestion, fluent::debug_suggestion,
"\"{:?}\", ", "\"{:?}\", ",
fmt_applicability, fmt_applicability,
); );
@ -196,7 +196,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
if let Some((open, close, del)) = find_delimiters(cx, span) { if let Some((open, close, del)) = find_delimiters(cx, span) {
lint.set_arg("already_suggested", suggest_display || suggest_debug); lint.set_arg("already_suggested", suggest_display || suggest_debug);
lint.multipart_suggestion( lint.multipart_suggestion(
fluent::lint::panic_suggestion, fluent::panic_suggestion,
if del == '(' { if del == '(' {
vec![(span.until(open), "std::panic::panic_any".into())] vec![(span.until(open), "std::panic::panic_any".into())]
} else { } else {
@ -254,30 +254,25 @@ fn check_panic_str<'tcx>(
.map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end))) .map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end)))
.collect(), .collect(),
}; };
cx.struct_span_lint( cx.struct_span_lint(NON_FMT_PANICS, arg_spans, fluent::lint_non_fmt_panic_unused, |lint| {
NON_FMT_PANICS, lint.set_arg("count", n_arguments);
arg_spans, lint.note(fluent::note);
fluent::lint::non_fmt_panic_unused, if is_arg_inside_call(arg.span, span) {
|lint| { lint.span_suggestion(
lint.set_arg("count", n_arguments); arg.span.shrink_to_hi(),
lint.note(fluent::lint::note); fluent::add_args_suggestion,
if is_arg_inside_call(arg.span, span) { ", ...",
lint.span_suggestion( Applicability::HasPlaceholders,
arg.span.shrink_to_hi(), );
fluent::lint::add_args_suggestion, lint.span_suggestion(
", ...", arg.span.shrink_to_lo(),
Applicability::HasPlaceholders, fluent::add_fmt_suggestion,
); "\"{}\", ",
lint.span_suggestion( Applicability::MachineApplicable,
arg.span.shrink_to_lo(), );
fluent::lint::add_fmt_suggestion, }
"\"{}\", ", lint
Applicability::MachineApplicable, });
);
}
lint
},
);
} else { } else {
let brace_spans: Option<Vec<_>> = let brace_spans: Option<Vec<_>> =
snippet.filter(|s| s.starts_with('"') || s.starts_with("r#")).map(|s| { snippet.filter(|s| s.starts_with('"') || s.starts_with("r#")).map(|s| {
@ -290,14 +285,14 @@ fn check_panic_str<'tcx>(
cx.struct_span_lint( cx.struct_span_lint(
NON_FMT_PANICS, NON_FMT_PANICS,
brace_spans.unwrap_or_else(|| vec![span]), brace_spans.unwrap_or_else(|| vec![span]),
fluent::lint::non_fmt_panic_braces, fluent::lint_non_fmt_panic_braces,
|lint| { |lint| {
lint.set_arg("count", count); lint.set_arg("count", count);
lint.note(fluent::lint::note); lint.note(fluent::note);
if is_arg_inside_call(arg.span, span) { if is_arg_inside_call(arg.span, span) {
lint.span_suggestion( lint.span_suggestion(
arg.span.shrink_to_lo(), arg.span.shrink_to_lo(),
fluent::lint::suggestion, fluent::suggestion,
"\"{}\", ", "\"{}\", ",
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );

View File

@ -139,7 +139,7 @@ impl NonCamelCaseTypes {
cx.struct_span_lint( cx.struct_span_lint(
NON_CAMEL_CASE_TYPES, NON_CAMEL_CASE_TYPES,
ident.span, ident.span,
fluent::lint::non_camel_case_type, fluent::lint_non_camel_case_type,
|lint| { |lint| {
let cc = to_camel_case(name); let cc = to_camel_case(name);
// We cannot provide meaningful suggestions // We cannot provide meaningful suggestions
@ -147,12 +147,12 @@ impl NonCamelCaseTypes {
if *name != cc { if *name != cc {
lint.span_suggestion( lint.span_suggestion(
ident.span, ident.span,
fluent::lint::suggestion, fluent::suggestion,
to_camel_case(name), to_camel_case(name),
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
} else { } else {
lint.span_label(ident.span, fluent::lint::label); lint.span_label(ident.span, fluent::label);
} }
lint.set_arg("sort", sort); lint.set_arg("sort", sort);
@ -284,7 +284,7 @@ impl NonSnakeCase {
let name = ident.name.as_str(); let name = ident.name.as_str();
if !is_snake_case(name) { if !is_snake_case(name) {
cx.struct_span_lint(NON_SNAKE_CASE, ident.span, fluent::lint::non_snake_case, |lint| { cx.struct_span_lint(NON_SNAKE_CASE, ident.span, fluent::lint_non_snake_case, |lint| {
let sc = NonSnakeCase::to_snake_case(name); let sc = NonSnakeCase::to_snake_case(name);
// We cannot provide meaningful suggestions // We cannot provide meaningful suggestions
// if the characters are in the category of "Uppercase Letter". // if the characters are in the category of "Uppercase Letter".
@ -298,13 +298,13 @@ impl NonSnakeCase {
// Instead, recommend renaming the identifier entirely or, if permitted, // Instead, recommend renaming the identifier entirely or, if permitted,
// escaping it to create a raw identifier. // escaping it to create a raw identifier.
if sc_ident.name.can_be_raw() { if sc_ident.name.can_be_raw() {
(fluent::lint::rename_or_convert_suggestion, sc_ident.to_string()) (fluent::rename_or_convert_suggestion, sc_ident.to_string())
} else { } else {
lint.note(fluent::lint::cannot_convert_note); lint.note(fluent::cannot_convert_note);
(fluent::lint::rename_suggestion, String::new()) (fluent::rename_suggestion, String::new())
} }
} else { } else {
(fluent::lint::convert_suggestion, sc.clone()) (fluent::convert_suggestion, sc.clone())
}; };
lint.span_suggestion( lint.span_suggestion(
@ -314,10 +314,10 @@ impl NonSnakeCase {
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
} else { } else {
lint.help(fluent::lint::help); lint.help(fluent::help);
} }
} else { } else {
lint.span_label(ident.span, fluent::lint::label); lint.span_label(ident.span, fluent::label);
} }
lint.set_arg("sort", sort); lint.set_arg("sort", sort);
@ -484,7 +484,7 @@ impl NonUpperCaseGlobals {
cx.struct_span_lint( cx.struct_span_lint(
NON_UPPER_CASE_GLOBALS, NON_UPPER_CASE_GLOBALS,
ident.span, ident.span,
fluent::lint::non_upper_case_global, fluent::lint_non_upper_case_global,
|lint| { |lint| {
let uc = NonSnakeCase::to_snake_case(&name).to_uppercase(); let uc = NonSnakeCase::to_snake_case(&name).to_uppercase();
// We cannot provide meaningful suggestions // We cannot provide meaningful suggestions
@ -492,12 +492,12 @@ impl NonUpperCaseGlobals {
if *name != uc { if *name != uc {
lint.span_suggestion( lint.span_suggestion(
ident.span, ident.span,
fluent::lint::suggestion, fluent::suggestion,
uc, uc,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
} else { } else {
lint.span_label(ident.span, fluent::lint::label); lint.span_label(ident.span, fluent::label);
} }
lint.set_arg("sort", sort); lint.set_arg("sort", sort);

View File

@ -85,11 +85,11 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
} }
let expr_span = expr.span; let expr_span = expr.span;
let span = expr_span.with_lo(receiver.span.hi()); let span = expr_span.with_lo(receiver.span.hi());
cx.struct_span_lint(NOOP_METHOD_CALL, span, fluent::lint::noop_method_call, |lint| { cx.struct_span_lint(NOOP_METHOD_CALL, span, fluent::lint_noop_method_call, |lint| {
lint.set_arg("method", call.ident.name) lint.set_arg("method", call.ident.name)
.set_arg("receiver_ty", receiver_ty) .set_arg("receiver_ty", receiver_ty)
.span_label(span, fluent::lint::label) .span_label(span, fluent::label)
.note(fluent::lint::note) .note(fluent::note)
}); });
} }
} }

View File

@ -141,11 +141,11 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(lint::opaque_hidden_inferred_bound)] #[diag(lint_opaque_hidden_inferred_bound)]
struct OpaqueHiddenInferredBoundLint<'tcx> { struct OpaqueHiddenInferredBoundLint<'tcx> {
ty: Ty<'tcx>, ty: Ty<'tcx>,
proj_ty: Ty<'tcx>, proj_ty: Ty<'tcx>,
#[label(lint::specifically)] #[label(specifically)]
assoc_pred_span: Span, assoc_pred_span: Span,
#[subdiagnostic] #[subdiagnostic]
add_bound: Option<AddBound<'tcx>>, add_bound: Option<AddBound<'tcx>>,
@ -153,7 +153,7 @@ struct OpaqueHiddenInferredBoundLint<'tcx> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[suggestion_verbose( #[suggestion_verbose(
lint::opaque_hidden_inferred_bound_sugg, lint_opaque_hidden_inferred_bound_sugg,
applicability = "machine-applicable", applicability = "machine-applicable",
code = " + {trait_ref}" code = " + {trait_ref}"
)] )]

View File

@ -32,11 +32,11 @@ impl<'tcx> LateLintPass<'tcx> for PassByValue {
cx.struct_span_lint( cx.struct_span_lint(
PASS_BY_VALUE, PASS_BY_VALUE,
ty.span, ty.span,
fluent::lint::pass_by_value, fluent::lint_pass_by_value,
|lint| { |lint| {
lint.set_arg("ty", t.clone()).span_suggestion( lint.set_arg("ty", t.clone()).span_suggestion(
ty.span, ty.span,
fluent::lint::suggestion, fluent::suggestion,
t, t,
// Changing type of function argument // Changing type of function argument
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,

View File

@ -51,11 +51,11 @@ fn maybe_lint_redundant_semis(cx: &EarlyContext<'_>, seq: &mut Option<(Span, boo
cx.struct_span_lint( cx.struct_span_lint(
REDUNDANT_SEMICOLONS, REDUNDANT_SEMICOLONS,
span, span,
fluent::lint::redundant_semicolons, fluent::lint_redundant_semicolons,
|lint| { |lint| {
lint.set_arg("multiple", multiple).span_suggestion( lint.set_arg("multiple", multiple).span_suggestion(
span, span,
fluent::lint::suggestion, fluent::suggestion,
"", "",
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
) )

View File

@ -106,7 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
cx.struct_span_lint( cx.struct_span_lint(
DROP_BOUNDS, DROP_BOUNDS,
span, span,
fluent::lint::drop_trait_constraints, fluent::lint_drop_trait_constraints,
|lint| { |lint| {
lint.set_arg("predicate", predicate) lint.set_arg("predicate", predicate)
.set_arg("needs_drop", cx.tcx.def_path_str(needs_drop)) .set_arg("needs_drop", cx.tcx.def_path_str(needs_drop))
@ -125,7 +125,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
if cx.tcx.lang_items().drop_trait() == def_id if cx.tcx.lang_items().drop_trait() == def_id
&& let Some(needs_drop) = cx.tcx.get_diagnostic_item(sym::needs_drop) && let Some(needs_drop) = cx.tcx.get_diagnostic_item(sym::needs_drop)
{ {
cx.struct_span_lint(DYN_DROP, bound.span, fluent::lint::drop_glue, |lint| { cx.struct_span_lint(DYN_DROP, bound.span, fluent::lint_drop_glue, |lint| {
lint.set_arg("needs_drop", cx.tcx.def_path_str(needs_drop)) lint.set_arg("needs_drop", cx.tcx.def_path_str(needs_drop))
}); });
} }

View File

@ -151,7 +151,7 @@ fn lint_overflowing_range_endpoint<'tcx>(
cx.struct_span_lint( cx.struct_span_lint(
OVERFLOWING_LITERALS, OVERFLOWING_LITERALS,
struct_expr.span, struct_expr.span,
fluent::lint::range_endpoint_out_of_range, fluent::lint_range_endpoint_out_of_range,
|lint| { |lint| {
use ast::{LitIntType, LitKind}; use ast::{LitIntType, LitKind};
@ -168,7 +168,7 @@ fn lint_overflowing_range_endpoint<'tcx>(
let suggestion = format!("{}..={}{}", start, lit_val - 1, suffix); let suggestion = format!("{}..={}{}", start, lit_val - 1, suffix);
lint.span_suggestion( lint.span_suggestion(
struct_expr.span, struct_expr.span,
fluent::lint::suggestion, fluent::suggestion,
suggestion, suggestion,
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
@ -233,7 +233,7 @@ fn report_bin_hex_error(
cx.struct_span_lint( cx.struct_span_lint(
OVERFLOWING_LITERALS, OVERFLOWING_LITERALS,
expr.span, expr.span,
fluent::lint::overflowing_bin_hex, fluent::lint_overflowing_bin_hex,
|lint| { |lint| {
let (t, actually) = match ty { let (t, actually) = match ty {
attr::IntType::SignedInt(t) => { attr::IntType::SignedInt(t) => {
@ -253,10 +253,10 @@ fn report_bin_hex_error(
if negative { if negative {
// If the value is negative, // If the value is negative,
// emits a note about the value itself, apart from the literal. // emits a note about the value itself, apart from the literal.
lint.note(fluent::lint::negative_note); lint.note(fluent::negative_note);
lint.note(fluent::lint::negative_becomes_note); lint.note(fluent::negative_becomes_note);
} else { } else {
lint.note(fluent::lint::positive_note); lint.note(fluent::positive_note);
} }
if let Some(sugg_ty) = if let Some(sugg_ty) =
get_type_suggestion(cx.typeck_results().node_type(expr.hir_id), val, negative) get_type_suggestion(cx.typeck_results().node_type(expr.hir_id), val, negative)
@ -266,12 +266,12 @@ fn report_bin_hex_error(
let (sans_suffix, _) = repr_str.split_at(pos); let (sans_suffix, _) = repr_str.split_at(pos);
lint.span_suggestion( lint.span_suggestion(
expr.span, expr.span,
fluent::lint::suggestion, fluent::suggestion,
format!("{}{}", sans_suffix, sugg_ty), format!("{}{}", sans_suffix, sugg_ty),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
} else { } else {
lint.help(fluent::lint::help); lint.help(fluent::help);
} }
} }
lint.set_arg("ty", t) lint.set_arg("ty", t)
@ -364,7 +364,7 @@ fn lint_int_literal<'tcx>(
return; return;
} }
cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, fluent::lint::overflowing_int, |lint| { cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, fluent::lint_overflowing_int, |lint| {
lint.set_arg("ty", t.name_str()) lint.set_arg("ty", t.name_str())
.set_arg( .set_arg(
"lit", "lit",
@ -375,13 +375,13 @@ fn lint_int_literal<'tcx>(
) )
.set_arg("min", min) .set_arg("min", min)
.set_arg("max", max) .set_arg("max", max)
.note(fluent::lint::note); .note(fluent::note);
if let Some(sugg_ty) = if let Some(sugg_ty) =
get_type_suggestion(cx.typeck_results().node_type(e.hir_id), v, negative) get_type_suggestion(cx.typeck_results().node_type(e.hir_id), v, negative)
{ {
lint.set_arg("suggestion_ty", sugg_ty); lint.set_arg("suggestion_ty", sugg_ty);
lint.help(fluent::lint::help); lint.help(fluent::help);
} }
lint lint
@ -412,11 +412,11 @@ fn lint_uint_literal<'tcx>(
cx.struct_span_lint( cx.struct_span_lint(
OVERFLOWING_LITERALS, OVERFLOWING_LITERALS,
par_e.span, par_e.span,
fluent::lint::only_cast_u8_to_char, fluent::lint_only_cast_u8_to_char,
|lint| { |lint| {
lint.span_suggestion( lint.span_suggestion(
par_e.span, par_e.span,
fluent::lint::suggestion, fluent::suggestion,
format!("'\\u{{{:X}}}'", lit_val), format!("'\\u{{{:X}}}'", lit_val),
Applicability::MachineApplicable, Applicability::MachineApplicable,
) )
@ -443,7 +443,7 @@ fn lint_uint_literal<'tcx>(
); );
return; return;
} }
cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, fluent::lint::overflowing_uint, |lint| { cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, fluent::lint_overflowing_uint, |lint| {
lint.set_arg("ty", t.name_str()) lint.set_arg("ty", t.name_str())
.set_arg( .set_arg(
"lit", "lit",
@ -454,7 +454,7 @@ fn lint_uint_literal<'tcx>(
) )
.set_arg("min", min) .set_arg("min", min)
.set_arg("max", max) .set_arg("max", max)
.note(fluent::lint::note) .note(fluent::note)
}); });
} }
} }
@ -487,7 +487,7 @@ fn lint_literal<'tcx>(
cx.struct_span_lint( cx.struct_span_lint(
OVERFLOWING_LITERALS, OVERFLOWING_LITERALS,
e.span, e.span,
fluent::lint::overflowing_literal, fluent::lint_overflowing_literal,
|lint| { |lint| {
lint.set_arg("ty", t.name_str()) lint.set_arg("ty", t.name_str())
.set_arg( .set_arg(
@ -497,7 +497,7 @@ fn lint_literal<'tcx>(
.span_to_snippet(lit.span) .span_to_snippet(lit.span)
.expect("must get snippet from literal"), .expect("must get snippet from literal"),
) )
.note(fluent::lint::note) .note(fluent::note)
}, },
); );
} }
@ -520,7 +520,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeLimits {
cx.struct_span_lint( cx.struct_span_lint(
UNUSED_COMPARISONS, UNUSED_COMPARISONS,
e.span, e.span,
fluent::lint::unused_comparisons, fluent::lint_unused_comparisons,
|lint| lint, |lint| lint,
); );
} }
@ -842,8 +842,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
self.emit_ffi_unsafe_type_lint( self.emit_ffi_unsafe_type_lint(
ty, ty,
sp, sp,
fluent::lint::improper_ctypes_array_reason, fluent::lint_improper_ctypes_array_reason,
Some(fluent::lint::improper_ctypes_array_help), Some(fluent::lint_improper_ctypes_array_help),
); );
true true
} else { } else {
@ -886,7 +886,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
} else { } else {
// All fields are ZSTs; this means that the type should behave // All fields are ZSTs; this means that the type should behave
// like (), which is FFI-unsafe // like (), which is FFI-unsafe
FfiUnsafe { ty, reason: fluent::lint::improper_ctypes_struct_zst, help: None } FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_struct_zst, help: None }
} }
} else { } else {
// We can't completely trust repr(C) markings; make sure the fields are // We can't completely trust repr(C) markings; make sure the fields are
@ -900,7 +900,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
FfiPhantom(..) if def.is_enum() => { FfiPhantom(..) if def.is_enum() => {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_enum_phantomdata, reason: fluent::lint_improper_ctypes_enum_phantomdata,
help: None, help: None,
}; };
} }
@ -936,7 +936,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
} else { } else {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_box, reason: fluent::lint_improper_ctypes_box,
help: None, help: None,
}; };
} }
@ -950,14 +950,14 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: if def.is_struct() { reason: if def.is_struct() {
fluent::lint::improper_ctypes_struct_layout_reason fluent::lint_improper_ctypes_struct_layout_reason
} else { } else {
fluent::lint::improper_ctypes_union_layout_reason fluent::lint_improper_ctypes_union_layout_reason
}, },
help: if def.is_struct() { help: if def.is_struct() {
Some(fluent::lint::improper_ctypes_struct_layout_help) Some(fluent::lint_improper_ctypes_struct_layout_help)
} else { } else {
Some(fluent::lint::improper_ctypes_union_layout_help) Some(fluent::lint_improper_ctypes_union_layout_help)
}, },
}; };
} }
@ -968,9 +968,9 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: if def.is_struct() { reason: if def.is_struct() {
fluent::lint::improper_ctypes_struct_non_exhaustive fluent::lint_improper_ctypes_struct_non_exhaustive
} else { } else {
fluent::lint::improper_ctypes_union_non_exhaustive fluent::lint_improper_ctypes_union_non_exhaustive
}, },
help: None, help: None,
}; };
@ -980,14 +980,14 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: if def.is_struct() { reason: if def.is_struct() {
fluent::lint::improper_ctypes_struct_fieldless_reason fluent::lint_improper_ctypes_struct_fieldless_reason
} else { } else {
fluent::lint::improper_ctypes_union_fieldless_reason fluent::lint_improper_ctypes_union_fieldless_reason
}, },
help: if def.is_struct() { help: if def.is_struct() {
Some(fluent::lint::improper_ctypes_struct_fieldless_help) Some(fluent::lint_improper_ctypes_struct_fieldless_help)
} else { } else {
Some(fluent::lint::improper_ctypes_union_fieldless_help) Some(fluent::lint_improper_ctypes_union_fieldless_help)
}, },
}; };
} }
@ -1008,8 +1008,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
if repr_nullable_ptr(self.cx, ty, self.mode).is_none() { if repr_nullable_ptr(self.cx, ty, self.mode).is_none() {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_enum_repr_reason, reason: fluent::lint_improper_ctypes_enum_repr_reason,
help: Some(fluent::lint::improper_ctypes_enum_repr_help), help: Some(fluent::lint_improper_ctypes_enum_repr_help),
}; };
} }
} }
@ -1017,7 +1017,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
if def.is_variant_list_non_exhaustive() && !def.did().is_local() { if def.is_variant_list_non_exhaustive() && !def.did().is_local() {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_non_exhaustive, reason: fluent::lint_improper_ctypes_non_exhaustive,
help: None, help: None,
}; };
} }
@ -1028,7 +1028,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
if is_non_exhaustive && !variant.def_id.is_local() { if is_non_exhaustive && !variant.def_id.is_local() {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_non_exhaustive_variant, reason: fluent::lint_improper_ctypes_non_exhaustive_variant,
help: None, help: None,
}; };
} }
@ -1046,12 +1046,12 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
ty::Char => FfiUnsafe { ty::Char => FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_char_reason, reason: fluent::lint_improper_ctypes_char_reason,
help: Some(fluent::lint::improper_ctypes_char_help), help: Some(fluent::lint_improper_ctypes_char_help),
}, },
ty::Int(ty::IntTy::I128) | ty::Uint(ty::UintTy::U128) => { ty::Int(ty::IntTy::I128) | ty::Uint(ty::UintTy::U128) => {
FfiUnsafe { ty, reason: fluent::lint::improper_ctypes_128bit, help: None } FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_128bit, help: None }
} }
// Primitive types with a stable representation. // Primitive types with a stable representation.
@ -1059,24 +1059,24 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
ty::Slice(_) => FfiUnsafe { ty::Slice(_) => FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_slice_reason, reason: fluent::lint_improper_ctypes_slice_reason,
help: Some(fluent::lint::improper_ctypes_slice_help), help: Some(fluent::lint_improper_ctypes_slice_help),
}, },
ty::Dynamic(..) => { ty::Dynamic(..) => {
FfiUnsafe { ty, reason: fluent::lint::improper_ctypes_dyn, help: None } FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_dyn, help: None }
} }
ty::Str => FfiUnsafe { ty::Str => FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_str_reason, reason: fluent::lint_improper_ctypes_str_reason,
help: Some(fluent::lint::improper_ctypes_str_help), help: Some(fluent::lint_improper_ctypes_str_help),
}, },
ty::Tuple(..) => FfiUnsafe { ty::Tuple(..) => FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_tuple_reason, reason: fluent::lint_improper_ctypes_tuple_reason,
help: Some(fluent::lint::improper_ctypes_tuple_help), help: Some(fluent::lint_improper_ctypes_tuple_help),
}, },
ty::RawPtr(ty::TypeAndMut { ty, .. }) | ty::Ref(_, ty, _) ty::RawPtr(ty::TypeAndMut { ty, .. }) | ty::Ref(_, ty, _)
@ -1107,8 +1107,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
if self.is_internal_abi(sig.abi()) { if self.is_internal_abi(sig.abi()) {
return FfiUnsafe { return FfiUnsafe {
ty, ty,
reason: fluent::lint::improper_ctypes_fnptr_reason, reason: fluent::lint_improper_ctypes_fnptr_reason,
help: Some(fluent::lint::improper_ctypes_fnptr_help), help: Some(fluent::lint_improper_ctypes_fnptr_help),
}; };
} }
@ -1139,7 +1139,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
// While opaque types are checked for earlier, if a projection in a struct field // While opaque types are checked for earlier, if a projection in a struct field
// normalizes to an opaque type, then it will reach this branch. // normalizes to an opaque type, then it will reach this branch.
ty::Opaque(..) => { ty::Opaque(..) => {
FfiUnsafe { ty, reason: fluent::lint::improper_ctypes_opaque, help: None } FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_opaque, help: None }
} }
// `extern "C" fn` functions can have type parameters, which may or may not be FFI-safe, // `extern "C" fn` functions can have type parameters, which may or may not be FFI-safe,
@ -1173,21 +1173,21 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
CItemKind::Definition => IMPROPER_CTYPES_DEFINITIONS, CItemKind::Definition => IMPROPER_CTYPES_DEFINITIONS,
}; };
self.cx.struct_span_lint(lint, sp, fluent::lint::improper_ctypes, |lint| { self.cx.struct_span_lint(lint, sp, fluent::lint_improper_ctypes, |lint| {
let item_description = match self.mode { let item_description = match self.mode {
CItemKind::Declaration => "block", CItemKind::Declaration => "block",
CItemKind::Definition => "fn", CItemKind::Definition => "fn",
}; };
lint.set_arg("ty", ty); lint.set_arg("ty", ty);
lint.set_arg("desc", item_description); lint.set_arg("desc", item_description);
lint.span_label(sp, fluent::lint::label); lint.span_label(sp, fluent::label);
if let Some(help) = help { if let Some(help) = help {
lint.help(help); lint.help(help);
} }
lint.note(note); lint.note(note);
if let ty::Adt(def, _) = ty.kind() { if let ty::Adt(def, _) = ty.kind() {
if let Some(sp) = self.cx.tcx.hir().span_if_local(def.did()) { if let Some(sp) = self.cx.tcx.hir().span_if_local(def.did()) {
lint.span_note(sp, fluent::lint::note); lint.span_note(sp, fluent::note);
} }
} }
lint lint
@ -1224,7 +1224,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
} }
if let Some(ty) = ty.visit_with(&mut ProhibitOpaqueTypes { cx: self.cx }).break_value() { if let Some(ty) = ty.visit_with(&mut ProhibitOpaqueTypes { cx: self.cx }).break_value() {
self.emit_ffi_unsafe_type_lint(ty, sp, fluent::lint::improper_ctypes_opaque, None); self.emit_ffi_unsafe_type_lint(ty, sp, fluent::lint_improper_ctypes_opaque, None);
true true
} else { } else {
false false
@ -1269,7 +1269,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
self.emit_ffi_unsafe_type_lint( self.emit_ffi_unsafe_type_lint(
ty, ty,
sp, sp,
fluent::lint::improper_ctypes_only_phantomdata, fluent::lint_improper_ctypes_only_phantomdata,
None, None,
); );
} }
@ -1403,7 +1403,7 @@ impl<'tcx> LateLintPass<'tcx> for VariantSizeDifferences {
cx.struct_span_lint( cx.struct_span_lint(
VARIANT_SIZE_DIFFERENCES, VARIANT_SIZE_DIFFERENCES,
enum_definition.variants[largest_index].span, enum_definition.variants[largest_index].span,
fluent::lint::variant_size_differences, fluent::lint_variant_size_differences,
|lint| lint.set_arg("largest", largest), |lint| lint.set_arg("largest", largest),
); );
} }
@ -1513,15 +1513,15 @@ impl InvalidAtomicOrdering {
fn check_atomic_load_store(cx: &LateContext<'_>, expr: &Expr<'_>) { fn check_atomic_load_store(cx: &LateContext<'_>, expr: &Expr<'_>) {
if let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[sym::load, sym::store]) if let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[sym::load, sym::store])
&& let Some((ordering_arg, invalid_ordering, msg)) = match method { && let Some((ordering_arg, invalid_ordering, msg)) = match method {
sym::load => Some((&args[0], sym::Release, fluent::lint::atomic_ordering_load)), sym::load => Some((&args[0], sym::Release, fluent::lint_atomic_ordering_load)),
sym::store => Some((&args[1], sym::Acquire, fluent::lint::atomic_ordering_store)), sym::store => Some((&args[1], sym::Acquire, fluent::lint_atomic_ordering_store)),
_ => None, _ => None,
} }
&& let Some(ordering) = Self::match_ordering(cx, ordering_arg) && let Some(ordering) = Self::match_ordering(cx, ordering_arg)
&& (ordering == invalid_ordering || ordering == sym::AcqRel) && (ordering == invalid_ordering || ordering == sym::AcqRel)
{ {
cx.struct_span_lint(INVALID_ATOMIC_ORDERING, ordering_arg.span, msg, |lint| { cx.struct_span_lint(INVALID_ATOMIC_ORDERING, ordering_arg.span, msg, |lint| {
lint.help(fluent::lint::help) lint.help(fluent::help)
}); });
} }
} }
@ -1533,9 +1533,9 @@ impl InvalidAtomicOrdering {
&& matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::fence | sym::compiler_fence)) && matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::fence | sym::compiler_fence))
&& Self::match_ordering(cx, &args[0]) == Some(sym::Relaxed) && Self::match_ordering(cx, &args[0]) == Some(sym::Relaxed)
{ {
cx.struct_span_lint(INVALID_ATOMIC_ORDERING, args[0].span, fluent::lint::atomic_ordering_fence, |lint| { cx.struct_span_lint(INVALID_ATOMIC_ORDERING, args[0].span, fluent::lint_atomic_ordering_fence, |lint| {
lint lint
.help(fluent::lint::help) .help(fluent::help)
}); });
} }
} }
@ -1554,7 +1554,7 @@ impl InvalidAtomicOrdering {
if matches!(fail_ordering, sym::Release | sym::AcqRel) { if matches!(fail_ordering, sym::Release | sym::AcqRel) {
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(lint::atomic_ordering_invalid)] #[diag(lint_atomic_ordering_invalid)]
#[help] #[help]
struct InvalidAtomicOrderingDiag { struct InvalidAtomicOrderingDiag {
method: Symbol, method: Symbol,

View File

@ -155,12 +155,12 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
}; };
if let Some(must_use_op) = must_use_op { if let Some(must_use_op) = must_use_op {
cx.struct_span_lint(UNUSED_MUST_USE, expr.span, fluent::lint::unused_op, |lint| { cx.struct_span_lint(UNUSED_MUST_USE, expr.span, fluent::lint_unused_op, |lint| {
lint.set_arg("op", must_use_op) lint.set_arg("op", must_use_op)
.span_label(expr.span, fluent::lint::label) .span_label(expr.span, fluent::label)
.span_suggestion_verbose( .span_suggestion_verbose(
expr.span.shrink_to_lo(), expr.span.shrink_to_lo(),
fluent::lint::suggestion, fluent::suggestion,
"let _ = ", "let _ = ",
Applicability::MachineApplicable, Applicability::MachineApplicable,
) )
@ -169,7 +169,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
} }
if !(type_permits_lack_of_use || fn_warned || op_warned) { if !(type_permits_lack_of_use || fn_warned || op_warned) {
cx.struct_span_lint(UNUSED_RESULTS, s.span, fluent::lint::unused_result, |lint| { cx.struct_span_lint(UNUSED_RESULTS, s.span, fluent::lint_unused_result, |lint| {
lint.set_arg("ty", ty) lint.set_arg("ty", ty)
}); });
} }
@ -272,14 +272,14 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
cx.struct_span_lint( cx.struct_span_lint(
UNUSED_MUST_USE, UNUSED_MUST_USE,
span, span,
fluent::lint::unused_closure, fluent::lint_unused_closure,
|lint| { |lint| {
// FIXME(davidtwco): this isn't properly translatable because of the // FIXME(davidtwco): this isn't properly translatable because of the
// pre/post strings // pre/post strings
lint.set_arg("count", plural_len) lint.set_arg("count", plural_len)
.set_arg("pre", descr_pre) .set_arg("pre", descr_pre)
.set_arg("post", descr_post) .set_arg("post", descr_post)
.note(fluent::lint::note) .note(fluent::note)
}, },
); );
true true
@ -288,14 +288,14 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
cx.struct_span_lint( cx.struct_span_lint(
UNUSED_MUST_USE, UNUSED_MUST_USE,
span, span,
fluent::lint::unused_generator, fluent::lint_unused_generator,
|lint| { |lint| {
// FIXME(davidtwco): this isn't properly translatable because of the // FIXME(davidtwco): this isn't properly translatable because of the
// pre/post strings // pre/post strings
lint.set_arg("count", plural_len) lint.set_arg("count", plural_len)
.set_arg("pre", descr_pre) .set_arg("pre", descr_pre)
.set_arg("post", descr_post) .set_arg("post", descr_post)
.note(fluent::lint::note) .note(fluent::note)
}, },
); );
true true
@ -317,7 +317,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
descr_post_path: &str, descr_post_path: &str,
) -> bool { ) -> bool {
if let Some(attr) = cx.tcx.get_attr(def_id, sym::must_use) { if let Some(attr) = cx.tcx.get_attr(def_id, sym::must_use) {
cx.struct_span_lint(UNUSED_MUST_USE, span, fluent::lint::unused_def, |lint| { cx.struct_span_lint(UNUSED_MUST_USE, span, fluent::lint_unused_def, |lint| {
// FIXME(davidtwco): this isn't properly translatable because of the pre/post // FIXME(davidtwco): this isn't properly translatable because of the pre/post
// strings // strings
lint.set_arg("pre", descr_pre_path); lint.set_arg("pre", descr_pre_path);
@ -369,17 +369,17 @@ impl<'tcx> LateLintPass<'tcx> for PathStatements {
cx.struct_span_lint( cx.struct_span_lint(
PATH_STATEMENTS, PATH_STATEMENTS,
s.span, s.span,
fluent::lint::path_statement_drop, fluent::lint_path_statement_drop,
|lint| { |lint| {
if let Ok(snippet) = cx.sess().source_map().span_to_snippet(expr.span) { if let Ok(snippet) = cx.sess().source_map().span_to_snippet(expr.span) {
lint.span_suggestion( lint.span_suggestion(
s.span, s.span,
fluent::lint::suggestion, fluent::suggestion,
format!("drop({});", snippet), format!("drop({});", snippet),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
} else { } else {
lint.span_help(s.span, fluent::lint::suggestion); lint.span_help(s.span, fluent::suggestion);
} }
lint lint
}, },
@ -388,7 +388,7 @@ impl<'tcx> LateLintPass<'tcx> for PathStatements {
cx.struct_span_lint( cx.struct_span_lint(
PATH_STATEMENTS, PATH_STATEMENTS,
s.span, s.span,
fluent::lint::path_statement_no_effect, fluent::lint_path_statement_no_effect,
|lint| lint, |lint| lint,
); );
} }
@ -561,7 +561,7 @@ trait UnusedDelimLint {
} else { } else {
MultiSpan::from(value_span) MultiSpan::from(value_span)
}; };
cx.struct_span_lint(self.lint(), primary_span, fluent::lint::unused_delim, |lint| { cx.struct_span_lint(self.lint(), primary_span, fluent::lint_unused_delim, |lint| {
lint.set_arg("delim", Self::DELIM_STR); lint.set_arg("delim", Self::DELIM_STR);
lint.set_arg("item", msg); lint.set_arg("item", msg);
if let Some((lo, hi)) = spans { if let Some((lo, hi)) = spans {
@ -570,7 +570,7 @@ trait UnusedDelimLint {
(hi, if keep_space.1 { " ".into() } else { "".into() }), (hi, if keep_space.1 { " ".into() } else { "".into() }),
]; ];
lint.multipart_suggestion( lint.multipart_suggestion(
fluent::lint::suggestion, fluent::suggestion,
replacement, replacement,
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
@ -1146,7 +1146,7 @@ impl UnusedImportBraces {
cx.struct_span_lint( cx.struct_span_lint(
UNUSED_IMPORT_BRACES, UNUSED_IMPORT_BRACES,
item.span, item.span,
fluent::lint::unused_import_braces, fluent::lint_unused_import_braces,
|lint| lint.set_arg("node", node_name), |lint| lint.set_arg("node", node_name),
); );
} }
@ -1201,9 +1201,9 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAllocation {
UNUSED_ALLOCATION, UNUSED_ALLOCATION,
e.span, e.span,
match m { match m {
adjustment::AutoBorrowMutability::Not => fluent::lint::unused_allocation, adjustment::AutoBorrowMutability::Not => fluent::lint_unused_allocation,
adjustment::AutoBorrowMutability::Mut { .. } => { adjustment::AutoBorrowMutability::Mut { .. } => {
fluent::lint::unused_allocation_mut fluent::lint_unused_allocation_mut
} }
}, },
|lint| lint, |lint| lint,

View File

@ -40,7 +40,7 @@ impl<'a> DiagnosticDerive<'a> {
span_err(builder.span, "diagnostic slug not specified") span_err(builder.span, "diagnostic slug not specified")
.help(&format!( .help(&format!(
"specify the slug as the first argument to the `#[diag(...)]` \ "specify the slug as the first argument to the `#[diag(...)]` \
attribute, such as `#[diag(hir_analysis::example_error)]`", attribute, such as `#[diag(hir_analysis_example_error)]`",
)) ))
.emit(); .emit();
return DiagnosticDeriveError::ErrorHandled.to_compile_error(); return DiagnosticDeriveError::ErrorHandled.to_compile_error();
@ -121,7 +121,7 @@ impl<'a> LintDiagnosticDerive<'a> {
span_err(builder.span, "diagnostic slug not specified") span_err(builder.span, "diagnostic slug not specified")
.help(&format!( .help(&format!(
"specify the slug as the first argument to the attribute, such as \ "specify the slug as the first argument to the attribute, such as \
`#[diag(compiletest::example)]`", `#[diag(compiletest_example)]`",
)) ))
.emit(); .emit();
return DiagnosticDeriveError::ErrorHandled.to_compile_error(); return DiagnosticDeriveError::ErrorHandled.to_compile_error();

View File

@ -23,14 +23,14 @@ use synstructure::Structure;
/// # extern crate rust_middle; /// # extern crate rust_middle;
/// # use rustc_middle::ty::Ty; /// # use rustc_middle::ty::Ty;
/// #[derive(Diagnostic)] /// #[derive(Diagnostic)]
/// #[diag(borrowck::move_out_of_borrow, code = "E0505")] /// #[diag(borrowck_move_out_of_borrow, code = "E0505")]
/// pub struct MoveOutOfBorrowError<'tcx> { /// pub struct MoveOutOfBorrowError<'tcx> {
/// pub name: Ident, /// pub name: Ident,
/// pub ty: Ty<'tcx>, /// pub ty: Ty<'tcx>,
/// #[primary_span] /// #[primary_span]
/// #[label] /// #[label]
/// pub span: Span, /// pub span: Span,
/// #[label(borrowck::first_borrow_label)] /// #[label(first_borrow_label)]
/// pub first_borrow_span: Span, /// pub first_borrow_span: Span,
/// #[suggestion(code = "{name}.clone()")] /// #[suggestion(code = "{name}.clone()")]
/// pub clone_sugg: Option<(Span, Applicability)> /// pub clone_sugg: Option<(Span, Applicability)>
@ -67,14 +67,14 @@ pub fn session_diagnostic_derive(s: Structure<'_>) -> TokenStream {
/// ///
/// ```ignore (rust) /// ```ignore (rust)
/// #[derive(LintDiagnostic)] /// #[derive(LintDiagnostic)]
/// #[diag(lint::atomic_ordering_invalid_fail_success)] /// #[diag(lint_atomic_ordering_invalid_fail_success)]
/// pub struct AtomicOrderingInvalidLint { /// pub struct AtomicOrderingInvalidLint {
/// method: Symbol, /// method: Symbol,
/// success_ordering: Symbol, /// success_ordering: Symbol,
/// fail_ordering: Symbol, /// fail_ordering: Symbol,
/// #[label(lint::fail_label)] /// #[label(fail_label)]
/// fail_order_arg_span: Span, /// fail_order_arg_span: Span,
/// #[label(lint::success_label)] /// #[label(success_label)]
/// #[suggestion( /// #[suggestion(
/// code = "std::sync::atomic::Ordering::{success_suggestion}", /// code = "std::sync::atomic::Ordering::{success_suggestion}",
/// applicability = "maybe-incorrect" /// applicability = "maybe-incorrect"
@ -115,12 +115,12 @@ pub fn lint_diagnostic_derive(s: Structure<'_>) -> TokenStream {
/// ```ignore (rust) /// ```ignore (rust)
/// #[derive(Subdiagnostic)] /// #[derive(Subdiagnostic)]
/// pub enum ExpectedIdentifierLabel<'tcx> { /// pub enum ExpectedIdentifierLabel<'tcx> {
/// #[label(parser::expected_identifier)] /// #[label(expected_identifier)]
/// WithoutFound { /// WithoutFound {
/// #[primary_span] /// #[primary_span]
/// span: Span, /// span: Span,
/// } /// }
/// #[label(parser::expected_identifier_found)] /// #[label(expected_identifier_found)]
/// WithFound { /// WithFound {
/// #[primary_span] /// #[primary_span]
/// span: Span, /// span: Span,

View File

@ -12,41 +12,41 @@ use rustc_target::spec::{PanicStrategy, TargetTriple};
use crate::locator::CrateFlavor; use crate::locator::CrateFlavor;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::rlib_required)] #[diag(metadata_rlib_required)]
pub struct RlibRequired { pub struct RlibRequired {
pub crate_name: Symbol, pub crate_name: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::lib_required)] #[diag(metadata_lib_required)]
pub struct LibRequired<'a> { pub struct LibRequired<'a> {
pub crate_name: Symbol, pub crate_name: Symbol,
pub kind: &'a str, pub kind: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::crate_dep_multiple)] #[diag(metadata_crate_dep_multiple)]
#[help] #[help]
pub struct CrateDepMultiple { pub struct CrateDepMultiple {
pub crate_name: Symbol, pub crate_name: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::two_panic_runtimes)] #[diag(metadata_two_panic_runtimes)]
pub struct TwoPanicRuntimes { pub struct TwoPanicRuntimes {
pub prev_name: Symbol, pub prev_name: Symbol,
pub cur_name: Symbol, pub cur_name: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::bad_panic_strategy)] #[diag(metadata_bad_panic_strategy)]
pub struct BadPanicStrategy { pub struct BadPanicStrategy {
pub runtime: Symbol, pub runtime: Symbol,
pub strategy: PanicStrategy, pub strategy: PanicStrategy,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::required_panic_strategy)] #[diag(metadata_required_panic_strategy)]
pub struct RequiredPanicStrategy { pub struct RequiredPanicStrategy {
pub crate_name: Symbol, pub crate_name: Symbol,
pub found_strategy: PanicStrategy, pub found_strategy: PanicStrategy,
@ -54,7 +54,7 @@ pub struct RequiredPanicStrategy {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::incompatible_panic_in_drop_strategy)] #[diag(metadata_incompatible_panic_in_drop_strategy)]
pub struct IncompatiblePanicInDropStrategy { pub struct IncompatiblePanicInDropStrategy {
pub crate_name: Symbol, pub crate_name: Symbol,
pub found_strategy: PanicStrategy, pub found_strategy: PanicStrategy,
@ -62,56 +62,56 @@ pub struct IncompatiblePanicInDropStrategy {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_names_in_link)] #[diag(metadata_multiple_names_in_link)]
pub struct MultipleNamesInLink { pub struct MultipleNamesInLink {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_kinds_in_link)] #[diag(metadata_multiple_kinds_in_link)]
pub struct MultipleKindsInLink { pub struct MultipleKindsInLink {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::link_name_form)] #[diag(metadata_link_name_form)]
pub struct LinkNameForm { pub struct LinkNameForm {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::link_kind_form)] #[diag(metadata_link_kind_form)]
pub struct LinkKindForm { pub struct LinkKindForm {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::link_modifiers_form)] #[diag(metadata_link_modifiers_form)]
pub struct LinkModifiersForm { pub struct LinkModifiersForm {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::link_cfg_form)] #[diag(metadata_link_cfg_form)]
pub struct LinkCfgForm { pub struct LinkCfgForm {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::wasm_import_form)] #[diag(metadata_wasm_import_form)]
pub struct WasmImportForm { pub struct WasmImportForm {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::empty_link_name, code = "E0454")] #[diag(metadata_empty_link_name, code = "E0454")]
pub struct EmptyLinkName { pub struct EmptyLinkName {
#[primary_span] #[primary_span]
#[label] #[label]
@ -119,21 +119,21 @@ pub struct EmptyLinkName {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::link_framework_apple, code = "E0455")] #[diag(metadata_link_framework_apple, code = "E0455")]
pub struct LinkFrameworkApple { pub struct LinkFrameworkApple {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::framework_only_windows, code = "E0455")] #[diag(metadata_framework_only_windows, code = "E0455")]
pub struct FrameworkOnlyWindows { pub struct FrameworkOnlyWindows {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::unknown_link_kind, code = "E0458")] #[diag(metadata_unknown_link_kind, code = "E0458")]
pub struct UnknownLinkKind<'a> { pub struct UnknownLinkKind<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
@ -142,49 +142,49 @@ pub struct UnknownLinkKind<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_link_modifiers)] #[diag(metadata_multiple_link_modifiers)]
pub struct MultipleLinkModifiers { pub struct MultipleLinkModifiers {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_cfgs)] #[diag(metadata_multiple_cfgs)]
pub struct MultipleCfgs { pub struct MultipleCfgs {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::link_cfg_single_predicate)] #[diag(metadata_link_cfg_single_predicate)]
pub struct LinkCfgSinglePredicate { pub struct LinkCfgSinglePredicate {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_wasm_import)] #[diag(metadata_multiple_wasm_import)]
pub struct MultipleWasmImport { pub struct MultipleWasmImport {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::unexpected_link_arg)] #[diag(metadata_unexpected_link_arg)]
pub struct UnexpectedLinkArg { pub struct UnexpectedLinkArg {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::invalid_link_modifier)] #[diag(metadata_invalid_link_modifier)]
pub struct InvalidLinkModifier { pub struct InvalidLinkModifier {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_modifiers)] #[diag(metadata_multiple_modifiers)]
pub struct MultipleModifiers<'a> { pub struct MultipleModifiers<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -192,28 +192,28 @@ pub struct MultipleModifiers<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::bundle_needs_static)] #[diag(metadata_bundle_needs_static)]
pub struct BundleNeedsStatic { pub struct BundleNeedsStatic {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::whole_archive_needs_static)] #[diag(metadata_whole_archive_needs_static)]
pub struct WholeArchiveNeedsStatic { pub struct WholeArchiveNeedsStatic {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::as_needed_compatibility)] #[diag(metadata_as_needed_compatibility)]
pub struct AsNeededCompatibility { pub struct AsNeededCompatibility {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::unknown_link_modifier)] #[diag(metadata_unknown_link_modifier)]
pub struct UnknownLinkModifier<'a> { pub struct UnknownLinkModifier<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -221,14 +221,14 @@ pub struct UnknownLinkModifier<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::incompatible_wasm_link)] #[diag(metadata_incompatible_wasm_link)]
pub struct IncompatibleWasmLink { pub struct IncompatibleWasmLink {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::link_requires_name, code = "E0459")] #[diag(metadata_link_requires_name, code = "E0459")]
pub struct LinkRequiresName { pub struct LinkRequiresName {
#[primary_span] #[primary_span]
#[label] #[label]
@ -236,126 +236,126 @@ pub struct LinkRequiresName {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::raw_dylib_no_nul)] #[diag(metadata_raw_dylib_no_nul)]
pub struct RawDylibNoNul { pub struct RawDylibNoNul {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::link_ordinal_raw_dylib)] #[diag(metadata_link_ordinal_raw_dylib)]
pub struct LinkOrdinalRawDylib { pub struct LinkOrdinalRawDylib {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::lib_framework_apple)] #[diag(metadata_lib_framework_apple)]
pub struct LibFrameworkApple; pub struct LibFrameworkApple;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::empty_renaming_target)] #[diag(metadata_empty_renaming_target)]
pub struct EmptyRenamingTarget<'a> { pub struct EmptyRenamingTarget<'a> {
pub lib_name: &'a str, pub lib_name: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::renaming_no_link)] #[diag(metadata_renaming_no_link)]
pub struct RenamingNoLink<'a> { pub struct RenamingNoLink<'a> {
pub lib_name: &'a str, pub lib_name: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_renamings)] #[diag(metadata_multiple_renamings)]
pub struct MultipleRenamings<'a> { pub struct MultipleRenamings<'a> {
pub lib_name: &'a str, pub lib_name: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::no_link_mod_override)] #[diag(metadata_no_link_mod_override)]
pub struct NoLinkModOverride { pub struct NoLinkModOverride {
#[primary_span] #[primary_span]
pub span: Option<Span>, pub span: Option<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::unsupported_abi_i686)] #[diag(metadata_unsupported_abi_i686)]
pub struct UnsupportedAbiI686 { pub struct UnsupportedAbiI686 {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::unsupported_abi)] #[diag(metadata_unsupported_abi)]
pub struct UnsupportedAbi { pub struct UnsupportedAbi {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::fail_create_file_encoder)] #[diag(metadata_fail_create_file_encoder)]
pub struct FailCreateFileEncoder { pub struct FailCreateFileEncoder {
pub err: Error, pub err: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::fail_seek_file)] #[diag(metadata_fail_seek_file)]
pub struct FailSeekFile { pub struct FailSeekFile {
pub err: Error, pub err: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::fail_write_file)] #[diag(metadata_fail_write_file)]
pub struct FailWriteFile { pub struct FailWriteFile {
pub err: Error, pub err: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::crate_not_panic_runtime)] #[diag(metadata_crate_not_panic_runtime)]
pub struct CrateNotPanicRuntime { pub struct CrateNotPanicRuntime {
pub crate_name: Symbol, pub crate_name: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::no_panic_strategy)] #[diag(metadata_no_panic_strategy)]
pub struct NoPanicStrategy { pub struct NoPanicStrategy {
pub crate_name: Symbol, pub crate_name: Symbol,
pub strategy: PanicStrategy, pub strategy: PanicStrategy,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::profiler_builtins_needs_core)] #[diag(metadata_profiler_builtins_needs_core)]
pub struct ProfilerBuiltinsNeedsCore; pub struct ProfilerBuiltinsNeedsCore;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::not_profiler_runtime)] #[diag(metadata_not_profiler_runtime)]
pub struct NotProfilerRuntime { pub struct NotProfilerRuntime {
pub crate_name: Symbol, pub crate_name: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::no_multiple_global_alloc)] #[diag(metadata_no_multiple_global_alloc)]
pub struct NoMultipleGlobalAlloc { pub struct NoMultipleGlobalAlloc {
#[primary_span] #[primary_span]
#[label] #[label]
pub span2: Span, pub span2: Span,
#[label(metadata::prev_global_alloc)] #[label(metadata_prev_global_alloc)]
pub span1: Span, pub span1: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::conflicting_global_alloc)] #[diag(metadata_conflicting_global_alloc)]
pub struct ConflictingGlobalAlloc { pub struct ConflictingGlobalAlloc {
pub crate_name: Symbol, pub crate_name: Symbol,
pub other_crate_name: Symbol, pub other_crate_name: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::global_alloc_required)] #[diag(metadata_global_alloc_required)]
pub struct GlobalAllocRequired; pub struct GlobalAllocRequired;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::no_transitive_needs_dep)] #[diag(metadata_no_transitive_needs_dep)]
pub struct NoTransitiveNeedsDep<'a> { pub struct NoTransitiveNeedsDep<'a> {
pub crate_name: Symbol, pub crate_name: Symbol,
pub needs_crate_name: &'a str, pub needs_crate_name: &'a str,
@ -363,14 +363,14 @@ pub struct NoTransitiveNeedsDep<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::failed_write_error)] #[diag(metadata_failed_write_error)]
pub struct FailedWriteError { pub struct FailedWriteError {
pub filename: PathBuf, pub filename: PathBuf,
pub err: Error, pub err: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::missing_native_library)] #[diag(metadata_missing_native_library)]
pub struct MissingNativeLibrary<'a> { pub struct MissingNativeLibrary<'a> {
libname: &'a str, libname: &'a str,
#[subdiagnostic] #[subdiagnostic]
@ -404,32 +404,32 @@ impl<'a> MissingNativeLibrary<'a> {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[help(metadata::only_provide_library_name)] #[help(metadata_only_provide_library_name)]
pub struct SuggestLibraryName<'a> { pub struct SuggestLibraryName<'a> {
suggested_name: &'a str, suggested_name: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::failed_create_tempdir)] #[diag(metadata_failed_create_tempdir)]
pub struct FailedCreateTempdir { pub struct FailedCreateTempdir {
pub err: Error, pub err: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::failed_create_file)] #[diag(metadata_failed_create_file)]
pub struct FailedCreateFile<'a> { pub struct FailedCreateFile<'a> {
pub filename: &'a Path, pub filename: &'a Path,
pub err: Error, pub err: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::failed_create_encoded_metadata)] #[diag(metadata_failed_create_encoded_metadata)]
pub struct FailedCreateEncodedMetadata { pub struct FailedCreateEncodedMetadata {
pub err: Error, pub err: Error,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::non_ascii_name)] #[diag(metadata_non_ascii_name)]
pub struct NonAsciiName { pub struct NonAsciiName {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -437,7 +437,7 @@ pub struct NonAsciiName {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::extern_location_not_exist)] #[diag(metadata_extern_location_not_exist)]
pub struct ExternLocationNotExist<'a> { pub struct ExternLocationNotExist<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -446,7 +446,7 @@ pub struct ExternLocationNotExist<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::extern_location_not_file)] #[diag(metadata_extern_location_not_file)]
pub struct ExternLocationNotFile<'a> { pub struct ExternLocationNotFile<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -466,7 +466,7 @@ impl IntoDiagnostic<'_> for MultipleCandidates {
self, self,
handler: &'_ rustc_errors::Handler, handler: &'_ rustc_errors::Handler,
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> { ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
let mut diag = handler.struct_err(rustc_errors::fluent::metadata::multiple_candidates); let mut diag = handler.struct_err(rustc_errors::fluent::metadata_multiple_candidates);
diag.set_arg("crate_name", self.crate_name); diag.set_arg("crate_name", self.crate_name);
diag.set_arg("flavor", self.flavor); diag.set_arg("flavor", self.flavor);
diag.code(error_code!(E0465)); diag.code(error_code!(E0465));
@ -479,7 +479,7 @@ impl IntoDiagnostic<'_> for MultipleCandidates {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_matching_crates, code = "E0464")] #[diag(metadata_multiple_matching_crates, code = "E0464")]
#[note] #[note]
pub struct MultipleMatchingCrates { pub struct MultipleMatchingCrates {
#[primary_span] #[primary_span]
@ -489,7 +489,7 @@ pub struct MultipleMatchingCrates {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::symbol_conflicts_current, code = "E0519")] #[diag(metadata_symbol_conflicts_current, code = "E0519")]
pub struct SymbolConflictsCurrent { pub struct SymbolConflictsCurrent {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -497,7 +497,7 @@ pub struct SymbolConflictsCurrent {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::symbol_conflicts_others, code = "E0523")] #[diag(metadata_symbol_conflicts_others, code = "E0523")]
pub struct SymbolConflictsOthers { pub struct SymbolConflictsOthers {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -505,7 +505,7 @@ pub struct SymbolConflictsOthers {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::stable_crate_id_collision)] #[diag(metadata_stable_crate_id_collision)]
pub struct StableCrateIdCollision { pub struct StableCrateIdCollision {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -514,7 +514,7 @@ pub struct StableCrateIdCollision {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::dl_error)] #[diag(metadata_dl_error)]
pub struct DlError { pub struct DlError {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -522,9 +522,9 @@ pub struct DlError {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::newer_crate_version, code = "E0460")] #[diag(metadata_newer_crate_version, code = "E0460")]
#[note] #[note]
#[note(metadata::found_crate_versions)] #[note(metadata_found_crate_versions)]
pub struct NewerCrateVersion { pub struct NewerCrateVersion {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -534,8 +534,8 @@ pub struct NewerCrateVersion {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::no_crate_with_triple, code = "E0461")] #[diag(metadata_no_crate_with_triple, code = "E0461")]
#[note(metadata::found_crate_versions)] #[note(metadata_found_crate_versions)]
pub struct NoCrateWithTriple<'a> { pub struct NoCrateWithTriple<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -546,8 +546,8 @@ pub struct NoCrateWithTriple<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::found_staticlib, code = "E0462")] #[diag(metadata_found_staticlib, code = "E0462")]
#[note(metadata::found_crate_versions)] #[note(metadata_found_crate_versions)]
#[help] #[help]
pub struct FoundStaticlib { pub struct FoundStaticlib {
#[primary_span] #[primary_span]
@ -558,8 +558,8 @@ pub struct FoundStaticlib {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::incompatible_rustc, code = "E0514")] #[diag(metadata_incompatible_rustc, code = "E0514")]
#[note(metadata::found_crate_versions)] #[note(metadata_found_crate_versions)]
#[help] #[help]
pub struct IncompatibleRustc { pub struct IncompatibleRustc {
#[primary_span] #[primary_span]
@ -582,7 +582,7 @@ impl IntoDiagnostic<'_> for InvalidMetadataFiles {
self, self,
handler: &'_ rustc_errors::Handler, handler: &'_ rustc_errors::Handler,
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> { ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
let mut diag = handler.struct_err(rustc_errors::fluent::metadata::invalid_meta_files); let mut diag = handler.struct_err(rustc_errors::fluent::metadata_invalid_meta_files);
diag.set_arg("crate_name", self.crate_name); diag.set_arg("crate_name", self.crate_name);
diag.set_arg("add_info", self.add_info); diag.set_arg("add_info", self.add_info);
diag.code(error_code!(E0786)); diag.code(error_code!(E0786));
@ -610,7 +610,7 @@ impl IntoDiagnostic<'_> for CannotFindCrate {
self, self,
handler: &'_ rustc_errors::Handler, handler: &'_ rustc_errors::Handler,
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> { ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
let mut diag = handler.struct_err(rustc_errors::fluent::metadata::cannot_find_crate); let mut diag = handler.struct_err(rustc_errors::fluent::metadata_cannot_find_crate);
diag.set_arg("crate_name", self.crate_name); diag.set_arg("crate_name", self.crate_name);
diag.set_arg("current_crate", self.current_crate); diag.set_arg("current_crate", self.current_crate);
diag.set_arg("add_info", self.add_info); diag.set_arg("add_info", self.add_info);
@ -621,38 +621,38 @@ impl IntoDiagnostic<'_> for CannotFindCrate {
&& self.locator_triple != TargetTriple::from_triple(config::host_triple()) && self.locator_triple != TargetTriple::from_triple(config::host_triple())
{ {
if self.missing_core { if self.missing_core {
diag.note(rustc_errors::fluent::metadata::target_not_installed); diag.note(rustc_errors::fluent::metadata_target_not_installed);
} else { } else {
diag.note(rustc_errors::fluent::metadata::target_no_std_support); diag.note(rustc_errors::fluent::metadata_target_no_std_support);
} }
// NOTE: this suggests using rustup, even though the user may not have it installed. // NOTE: this suggests using rustup, even though the user may not have it installed.
// That's because they could choose to install it; or this may give them a hint which // That's because they could choose to install it; or this may give them a hint which
// target they need to install from their distro. // target they need to install from their distro.
if self.missing_core { if self.missing_core {
diag.help(rustc_errors::fluent::metadata::consider_downloading_target); diag.help(rustc_errors::fluent::metadata_consider_downloading_target);
} }
// Suggest using #![no_std]. #[no_core] is unstable and not really supported anyway. // Suggest using #![no_std]. #[no_core] is unstable and not really supported anyway.
// NOTE: this is a dummy span if `extern crate std` was injected by the compiler. // NOTE: this is a dummy span if `extern crate std` was injected by the compiler.
// If it's not a dummy, that means someone added `extern crate std` explicitly and // If it's not a dummy, that means someone added `extern crate std` explicitly and
// `#![no_std]` won't help. // `#![no_std]` won't help.
if !self.missing_core && self.span.is_dummy() { if !self.missing_core && self.span.is_dummy() {
diag.note(rustc_errors::fluent::metadata::std_required); diag.note(rustc_errors::fluent::metadata_std_required);
} }
if self.is_nightly_build { if self.is_nightly_build {
diag.help(rustc_errors::fluent::metadata::consider_building_std); diag.help(rustc_errors::fluent::metadata_consider_building_std);
} }
} else if self.crate_name == self.profiler_runtime { } else if self.crate_name == self.profiler_runtime {
diag.note(rustc_errors::fluent::metadata::compiler_missing_profiler); diag.note(rustc_errors::fluent::metadata_compiler_missing_profiler);
} else if self.crate_name.as_str().starts_with("rustc_") { } else if self.crate_name.as_str().starts_with("rustc_") {
diag.help(rustc_errors::fluent::metadata::install_missing_components); diag.help(rustc_errors::fluent::metadata_install_missing_components);
} }
diag.span_label(self.span, rustc_errors::fluent::metadata::cant_find_crate); diag.span_label(self.span, rustc_errors::fluent::metadata_cant_find_crate);
diag diag
} }
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::no_dylib_plugin, code = "E0457")] #[diag(metadata_no_dylib_plugin, code = "E0457")]
pub struct NoDylibPlugin { pub struct NoDylibPlugin {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -660,7 +660,7 @@ pub struct NoDylibPlugin {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::crate_location_unknown_type)] #[diag(metadata_crate_location_unknown_type)]
pub struct CrateLocationUnknownType<'a> { pub struct CrateLocationUnknownType<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -668,7 +668,7 @@ pub struct CrateLocationUnknownType<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::lib_filename_form)] #[diag(metadata_lib_filename_form)]
pub struct LibFilenameForm<'a> { pub struct LibFilenameForm<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -677,28 +677,28 @@ pub struct LibFilenameForm<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::multiple_import_name_type)] #[diag(metadata_multiple_import_name_type)]
pub struct MultipleImportNameType { pub struct MultipleImportNameType {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::import_name_type_form)] #[diag(metadata_import_name_type_form)]
pub struct ImportNameTypeForm { pub struct ImportNameTypeForm {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::import_name_type_x86)] #[diag(metadata_import_name_type_x86)]
pub struct ImportNameTypeX86 { pub struct ImportNameTypeX86 {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::unknown_import_name_type)] #[diag(metadata_unknown_import_name_type)]
pub struct UnknownImportNameType<'a> { pub struct UnknownImportNameType<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -706,7 +706,7 @@ pub struct UnknownImportNameType<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(metadata::import_name_type_raw)] #[diag(metadata_import_name_type_raw)]
pub struct ImportNameTypeRaw { pub struct ImportNameTypeRaw {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,

View File

@ -4,7 +4,7 @@ use rustc_span::Span;
use crate::ty::Ty; use crate::ty::Ty;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(middle::drop_check_overflow, code = "E0320")] #[diag(middle_drop_check_overflow, code = "E0320")]
#[note] #[note]
pub struct DropCheckOverflow<'tcx> { pub struct DropCheckOverflow<'tcx> {
#[primary_span] #[primary_span]
@ -14,7 +14,7 @@ pub struct DropCheckOverflow<'tcx> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(middle::opaque_hidden_type_mismatch)] #[diag(middle_opaque_hidden_type_mismatch)]
pub struct OpaqueHiddenTypeMismatch<'tcx> { pub struct OpaqueHiddenTypeMismatch<'tcx> {
pub self_ty: Ty<'tcx>, pub self_ty: Ty<'tcx>,
pub other_ty: Ty<'tcx>, pub other_ty: Ty<'tcx>,
@ -27,12 +27,12 @@ pub struct OpaqueHiddenTypeMismatch<'tcx> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum TypeMismatchReason { pub enum TypeMismatchReason {
#[label(middle::conflict_types)] #[label(middle_conflict_types)]
ConflictType { ConflictType {
#[primary_span] #[primary_span]
span: Span, span: Span,
}, },
#[note(middle::previous_use_here)] #[note(middle_previous_use_here)]
PreviousUse { PreviousUse {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -40,7 +40,7 @@ pub enum TypeMismatchReason {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(middle::limit_invalid)] #[diag(middle_limit_invalid)]
pub struct LimitInvalid<'a> { pub struct LimitInvalid<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -50,7 +50,7 @@ pub struct LimitInvalid<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(middle::const_eval_non_int)] #[diag(middle_const_eval_non_int)]
pub struct ConstEvalNonIntError { pub struct ConstEvalNonIntError {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,

View File

@ -513,7 +513,7 @@ impl<'tcx> TypeVisitor<'tcx> for IsSuggestableVisitor<'tcx> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(borrowck::const_not_used_in_type_alias)] #[diag(borrowck_const_not_used_in_type_alias)]
pub(super) struct ConstNotUsedTraitAlias { pub(super) struct ConstNotUsedTraitAlias {
pub ct: String, pub ct: String,
#[primary_span] #[primary_span]

View File

@ -196,16 +196,16 @@ impl<'a> IntoDiagnostic<'a, !> for LayoutError<'a> {
match self { match self {
LayoutError::Unknown(ty) => { LayoutError::Unknown(ty) => {
diag.set_arg("ty", ty); diag.set_arg("ty", ty);
diag.set_primary_message(rustc_errors::fluent::middle::unknown_layout); diag.set_primary_message(rustc_errors::fluent::middle_unknown_layout);
} }
LayoutError::SizeOverflow(ty) => { LayoutError::SizeOverflow(ty) => {
diag.set_arg("ty", ty); diag.set_arg("ty", ty);
diag.set_primary_message(rustc_errors::fluent::middle::values_too_big); diag.set_primary_message(rustc_errors::fluent::middle_values_too_big);
} }
LayoutError::NormalizationFailure(ty, e) => { LayoutError::NormalizationFailure(ty, e) => {
diag.set_arg("ty", ty); diag.set_arg("ty", ty);
diag.set_arg("failure_ty", e.get_type_for_failure()); diag.set_arg("failure_ty", e.get_type_for_failure());
diag.set_primary_message(rustc_errors::fluent::middle::cannot_be_normalized); diag.set_primary_message(rustc_errors::fluent::middle_cannot_be_normalized);
} }
} }
diag diag

View File

@ -2,21 +2,21 @@ use rustc_macros::Diagnostic;
use rustc_span::{Span, Symbol}; use rustc_span::{Span, Symbol};
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::path_must_end_in_filename)] #[diag(mir_dataflow_path_must_end_in_filename)]
pub(crate) struct PathMustEndInFilename { pub(crate) struct PathMustEndInFilename {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::unknown_formatter)] #[diag(mir_dataflow_unknown_formatter)]
pub(crate) struct UnknownFormatter { pub(crate) struct UnknownFormatter {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::duplicate_values_for)] #[diag(mir_dataflow_duplicate_values_for)]
pub(crate) struct DuplicateValuesFor { pub(crate) struct DuplicateValuesFor {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -24,7 +24,7 @@ pub(crate) struct DuplicateValuesFor {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::requires_an_argument)] #[diag(mir_dataflow_requires_an_argument)]
pub(crate) struct RequiresAnArgument { pub(crate) struct RequiresAnArgument {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -32,39 +32,39 @@ pub(crate) struct RequiresAnArgument {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::stop_after_dataflow_ended_compilation)] #[diag(mir_dataflow_stop_after_dataflow_ended_compilation)]
pub(crate) struct StopAfterDataFlowEndedCompilation; pub(crate) struct StopAfterDataFlowEndedCompilation;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::peek_must_be_place_or_ref_place)] #[diag(mir_dataflow_peek_must_be_place_or_ref_place)]
pub(crate) struct PeekMustBePlaceOrRefPlace { pub(crate) struct PeekMustBePlaceOrRefPlace {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::peek_must_be_not_temporary)] #[diag(mir_dataflow_peek_must_be_not_temporary)]
pub(crate) struct PeekMustBeNotTemporary { pub(crate) struct PeekMustBeNotTemporary {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::peek_bit_not_set)] #[diag(mir_dataflow_peek_bit_not_set)]
pub(crate) struct PeekBitNotSet { pub(crate) struct PeekBitNotSet {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::peek_argument_not_a_local)] #[diag(mir_dataflow_peek_argument_not_a_local)]
pub(crate) struct PeekArgumentNotALocal { pub(crate) struct PeekArgumentNotALocal {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(mir_dataflow::peek_argument_untracked)] #[diag(mir_dataflow_peek_argument_untracked)]
pub(crate) struct PeekArgumentUntracked { pub(crate) struct PeekArgumentUntracked {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,

View File

@ -6,7 +6,7 @@ use rustc_macros::{Diagnostic, LintDiagnostic};
use rustc_span::Span; use rustc_span::Span;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(monomorphize::recursion_limit)] #[diag(monomorphize_recursion_limit)]
pub struct RecursionLimit { pub struct RecursionLimit {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -14,26 +14,26 @@ pub struct RecursionLimit {
#[note] #[note]
pub def_span: Span, pub def_span: Span,
pub def_path_str: String, pub def_path_str: String,
#[note(monomorphize::written_to_path)] #[note(monomorphize_written_to_path)]
pub was_written: Option<()>, pub was_written: Option<()>,
pub path: PathBuf, pub path: PathBuf,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(monomorphize::type_length_limit)] #[diag(monomorphize_type_length_limit)]
#[help(monomorphize::consider_type_length_limit)] #[help(monomorphize_consider_type_length_limit)]
pub struct TypeLengthLimit { pub struct TypeLengthLimit {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub shrunk: String, pub shrunk: String,
#[note(monomorphize::written_to_path)] #[note(monomorphize_written_to_path)]
pub was_written: Option<()>, pub was_written: Option<()>,
pub path: PathBuf, pub path: PathBuf,
pub type_length: usize, pub type_length: usize,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(monomorphize::requires_lang_item)] #[diag(monomorphize_requires_lang_item)]
pub struct RequiresLangItem { pub struct RequiresLangItem {
pub lang_item: String, pub lang_item: String,
} }
@ -49,8 +49,7 @@ impl IntoDiagnostic<'_> for UnusedGenericParams {
self, self,
handler: &'_ rustc_errors::Handler, handler: &'_ rustc_errors::Handler,
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> { ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
let mut diag = let mut diag = handler.struct_err(rustc_errors::fluent::monomorphize_unused_generic_params);
handler.struct_err(rustc_errors::fluent::monomorphize::unused_generic_params);
diag.set_span(self.span); diag.set_span(self.span);
for (span, name) in self.param_spans.into_iter().zip(self.param_names) { for (span, name) in self.param_spans.into_iter().zip(self.param_names) {
// FIXME: I can figure out how to do a label with a fluent string with a fixed message, // FIXME: I can figure out how to do a label with a fluent string with a fixed message,
@ -63,7 +62,7 @@ impl IntoDiagnostic<'_> for UnusedGenericParams {
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(monomorphize::large_assignments)] #[diag(monomorphize_large_assignments)]
#[note] #[note]
pub struct LargeAssignmentsLint { pub struct LargeAssignmentsLint {
#[label] #[label]
@ -73,11 +72,11 @@ pub struct LargeAssignmentsLint {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(monomorphize::unknown_partition_strategy)] #[diag(monomorphize_unknown_partition_strategy)]
pub struct UnknownPartitionStrategy; pub struct UnknownPartitionStrategy;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(monomorphize::symbol_already_defined)] #[diag(monomorphize_symbol_already_defined)]
pub struct SymbolAlreadyDefined { pub struct SymbolAlreadyDefined {
#[primary_span] #[primary_span]
pub span: Option<Span>, pub span: Option<Span>,

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@ impl<'a> Parser<'a> {
let span = self.token.span; let span = self.token.span;
let mut err = self.sess.span_diagnostic.struct_span_err_with_code( let mut err = self.sess.span_diagnostic.struct_span_err_with_code(
span, span,
fluent::parser::inner_doc_comment_not_permitted, fluent::parser_inner_doc_comment_not_permitted,
error_code!(E0753), error_code!(E0753),
); );
if let Some(replacement_span) = self.annotate_following_item_if_applicable( if let Some(replacement_span) = self.annotate_following_item_if_applicable(
@ -66,10 +66,10 @@ impl<'a> Parser<'a> {
token::CommentKind::Block => OuterAttributeType::DocBlockComment, token::CommentKind::Block => OuterAttributeType::DocBlockComment,
}, },
) { ) {
err.note(fluent::parser::note); err.note(fluent::note);
err.span_suggestion_verbose( err.span_suggestion_verbose(
replacement_span, replacement_span,
fluent::parser::suggestion, fluent::suggestion,
"", "",
rustc_errors::Applicability::MachineApplicable, rustc_errors::Applicability::MachineApplicable,
); );
@ -173,10 +173,10 @@ impl<'a> Parser<'a> {
Ok(Some(item)) => { Ok(Some(item)) => {
// FIXME(#100717) // FIXME(#100717)
err.set_arg("item", item.kind.descr()); err.set_arg("item", item.kind.descr());
err.span_label(item.span, fluent::parser::label_does_not_annotate_this); err.span_label(item.span, fluent::label_does_not_annotate_this);
err.span_suggestion_verbose( err.span_suggestion_verbose(
replacement_span, replacement_span,
fluent::parser::sugg_change_inner_to_outer, fluent::sugg_change_inner_to_outer,
match attr_type { match attr_type {
OuterAttributeType::Attribute => "", OuterAttributeType::Attribute => "",
OuterAttributeType::DocBlockComment => "*", OuterAttributeType::DocBlockComment => "*",
@ -200,27 +200,27 @@ impl<'a> Parser<'a> {
Some(InnerAttrForbiddenReason::AfterOuterDocComment { prev_doc_comment_span }) => { Some(InnerAttrForbiddenReason::AfterOuterDocComment { prev_doc_comment_span }) => {
let mut diag = self.struct_span_err( let mut diag = self.struct_span_err(
attr_sp, attr_sp,
fluent::parser::inner_attr_not_permitted_after_outer_doc_comment, fluent::parser_inner_attr_not_permitted_after_outer_doc_comment,
); );
diag.span_label(attr_sp, fluent::parser::label_attr) diag.span_label(attr_sp, fluent::label_attr)
.span_label(prev_doc_comment_span, fluent::parser::label_prev_doc_comment); .span_label(prev_doc_comment_span, fluent::label_prev_doc_comment);
diag diag
} }
Some(InnerAttrForbiddenReason::AfterOuterAttribute { prev_outer_attr_sp }) => { Some(InnerAttrForbiddenReason::AfterOuterAttribute { prev_outer_attr_sp }) => {
let mut diag = self.struct_span_err( let mut diag = self.struct_span_err(
attr_sp, attr_sp,
fluent::parser::inner_attr_not_permitted_after_outer_attr, fluent::parser_inner_attr_not_permitted_after_outer_attr,
); );
diag.span_label(attr_sp, fluent::parser::label_attr) diag.span_label(attr_sp, fluent::label_attr)
.span_label(prev_outer_attr_sp, fluent::parser::label_prev_attr); .span_label(prev_outer_attr_sp, fluent::label_prev_attr);
diag diag
} }
Some(InnerAttrForbiddenReason::InCodeBlock) | None => { Some(InnerAttrForbiddenReason::InCodeBlock) | None => {
self.struct_span_err(attr_sp, fluent::parser::inner_attr_not_permitted) self.struct_span_err(attr_sp, fluent::parser_inner_attr_not_permitted)
} }
}; };
diag.note(fluent::parser::inner_attr_explanation); diag.note(fluent::parser_inner_attr_explanation);
if self if self
.annotate_following_item_if_applicable( .annotate_following_item_if_applicable(
&mut diag, &mut diag,
@ -229,7 +229,7 @@ impl<'a> Parser<'a> {
) )
.is_some() .is_some()
{ {
diag.note(fluent::parser::outer_attr_explanation); diag.note(fluent::parser_outer_attr_explanation);
}; };
diag.emit(); diag.emit();
} }

View File

@ -926,7 +926,7 @@ impl<'a> Parser<'a> {
if self.eat(&token::Gt) { if self.eat(&token::Gt) {
e.span_suggestion_verbose( e.span_suggestion_verbose(
binop.span.shrink_to_lo(), binop.span.shrink_to_lo(),
fluent::parser::sugg_turbofish_syntax, fluent::parser_sugg_turbofish_syntax,
"::", "::",
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
) )

View File

@ -822,8 +822,8 @@ impl CheckAttrVisitor<'_> {
if let Some((prev_inline, prev_span)) = *specified_inline { if let Some((prev_inline, prev_span)) = *specified_inline {
if do_inline != prev_inline { if do_inline != prev_inline {
let mut spans = MultiSpan::from_spans(vec![prev_span, meta.span()]); let mut spans = MultiSpan::from_spans(vec![prev_span, meta.span()]);
spans.push_span_label(prev_span, fluent::passes::doc_inline_conflict_first); spans.push_span_label(prev_span, fluent::passes_doc_inline_conflict_first);
spans.push_span_label(meta.span(), fluent::passes::doc_inline_conflict_second); spans.push_span_label(meta.span(), fluent::passes_doc_inline_conflict_second);
self.tcx.sess.emit_err(errors::DocKeywordConflict { spans }); self.tcx.sess.emit_err(errors::DocKeywordConflict { spans });
return false; return false;
} }
@ -873,7 +873,7 @@ impl CheckAttrVisitor<'_> {
INVALID_DOC_ATTRIBUTES, INVALID_DOC_ATTRIBUTES,
hir_id, hir_id,
meta.span(), meta.span(),
fluent::passes::attr_crate_level, fluent::passes_attr_crate_level,
|err| { |err| {
if attr.style == AttrStyle::Outer if attr.style == AttrStyle::Outer
&& self.tcx.hir().get_parent_item(hir_id) == CRATE_OWNER_ID && self.tcx.hir().get_parent_item(hir_id) == CRATE_OWNER_ID
@ -882,15 +882,15 @@ impl CheckAttrVisitor<'_> {
src.insert(1, '!'); src.insert(1, '!');
err.span_suggestion_verbose( err.span_suggestion_verbose(
attr.span, attr.span,
fluent::passes::suggestion, fluent::suggestion,
src, src,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
} else { } else {
err.span_help(attr.span, fluent::passes::help); err.span_help(attr.span, fluent::help);
} }
} }
err.note(fluent::passes::note); err.note(fluent::note);
err err
}, },
); );

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ use rustc_macros::Diagnostic;
use rustc_span::Span; use rustc_span::Span;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(plugin_impl::load_plugin_error)] #[diag(plugin_impl_load_plugin_error)]
pub struct LoadPluginError { pub struct LoadPluginError {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -12,7 +12,7 @@ pub struct LoadPluginError {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(plugin_impl::malformed_plugin_attribute, code = "E0498")] #[diag(plugin_impl_malformed_plugin_attribute, code = "E0498")]
pub struct MalformedPluginAttribute { pub struct MalformedPluginAttribute {
#[primary_span] #[primary_span]
#[label] #[label]

View File

@ -3,7 +3,7 @@ use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_span::{Span, Symbol}; use rustc_span::{Span, Symbol};
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(privacy::field_is_private, code = "E0451")] #[diag(privacy_field_is_private, code = "E0451")]
pub struct FieldIsPrivate { pub struct FieldIsPrivate {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -16,13 +16,13 @@ pub struct FieldIsPrivate {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum FieldIsPrivateLabel { pub enum FieldIsPrivateLabel {
#[label(privacy::field_is_private_is_update_syntax_label)] #[label(privacy_field_is_private_is_update_syntax_label)]
IsUpdateSyntax { IsUpdateSyntax {
#[primary_span] #[primary_span]
span: Span, span: Span,
field_name: Symbol, field_name: Symbol,
}, },
#[label(privacy::field_is_private_label)] #[label(privacy_field_is_private_label)]
Other { Other {
#[primary_span] #[primary_span]
span: Span, span: Span,
@ -30,7 +30,7 @@ pub enum FieldIsPrivateLabel {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(privacy::item_is_private)] #[diag(privacy_item_is_private)]
pub struct ItemIsPrivate<'a> { pub struct ItemIsPrivate<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
@ -40,7 +40,7 @@ pub struct ItemIsPrivate<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(privacy::unnamed_item_is_private)] #[diag(privacy_unnamed_item_is_private)]
pub struct UnnamedItemIsPrivate { pub struct UnnamedItemIsPrivate {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -49,7 +49,7 @@ pub struct UnnamedItemIsPrivate {
// Duplicate of `InPublicInterface` but with a different error code, shares the same slug. // Duplicate of `InPublicInterface` but with a different error code, shares the same slug.
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(privacy::in_public_interface, code = "E0445")] #[diag(privacy_in_public_interface, code = "E0445")]
pub struct InPublicInterfaceTraits<'a> { pub struct InPublicInterfaceTraits<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
@ -57,13 +57,13 @@ pub struct InPublicInterfaceTraits<'a> {
pub vis_descr: &'static str, pub vis_descr: &'static str,
pub kind: &'a str, pub kind: &'a str,
pub descr: DiagnosticArgFromDisplay<'a>, pub descr: DiagnosticArgFromDisplay<'a>,
#[label(privacy::visibility_label)] #[label(visibility_label)]
pub vis_span: Span, pub vis_span: Span,
} }
// Duplicate of `InPublicInterfaceTraits` but with a different error code, shares the same slug. // Duplicate of `InPublicInterfaceTraits` but with a different error code, shares the same slug.
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(privacy::in_public_interface, code = "E0446")] #[diag(privacy_in_public_interface, code = "E0446")]
pub struct InPublicInterface<'a> { pub struct InPublicInterface<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
@ -71,12 +71,12 @@ pub struct InPublicInterface<'a> {
pub vis_descr: &'static str, pub vis_descr: &'static str,
pub kind: &'a str, pub kind: &'a str,
pub descr: DiagnosticArgFromDisplay<'a>, pub descr: DiagnosticArgFromDisplay<'a>,
#[label(privacy::visibility_label)] #[label(visibility_label)]
pub vis_span: Span, pub vis_span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(privacy::report_effective_visibility)] #[diag(privacy_report_effective_visibility)]
pub struct ReportEffectiveVisibility { pub struct ReportEffectiveVisibility {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -84,7 +84,7 @@ pub struct ReportEffectiveVisibility {
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(privacy::from_private_dep_in_public_interface)] #[diag(privacy_from_private_dep_in_public_interface)]
pub struct FromPrivateDependencyInPublicInterface<'a> { pub struct FromPrivateDependencyInPublicInterface<'a> {
pub kind: &'a str, pub kind: &'a str,
pub descr: DiagnosticArgFromDisplay<'a>, pub descr: DiagnosticArgFromDisplay<'a>,
@ -92,7 +92,7 @@ pub struct FromPrivateDependencyInPublicInterface<'a> {
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(privacy::private_in_public_lint)] #[diag(privacy_private_in_public_lint)]
pub struct PrivateInPublicLint<'a> { pub struct PrivateInPublicLint<'a> {
pub vis_descr: &'static str, pub vis_descr: &'static str,
pub kind: &'a str, pub kind: &'a str,

View File

@ -3,7 +3,7 @@ use rustc_session::Limit;
use rustc_span::{Span, Symbol}; use rustc_span::{Span, Symbol};
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(query_system::cycle_stack_middle)] #[note(query_system_cycle_stack_middle)]
pub struct CycleStack { pub struct CycleStack {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -19,24 +19,24 @@ pub enum HandleCycleError {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum StackCount { pub enum StackCount {
#[note(query_system::cycle_stack_single)] #[note(query_system_cycle_stack_single)]
Single, Single,
#[note(query_system::cycle_stack_multiple)] #[note(query_system_cycle_stack_multiple)]
Multiple, Multiple,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum Alias { pub enum Alias {
#[note(query_system::cycle_recursive_ty_alias)] #[note(query_system_cycle_recursive_ty_alias)]
#[help(query_system::cycle_recursive_ty_alias_help1)] #[help(query_system_cycle_recursive_ty_alias_help1)]
#[help(query_system::cycle_recursive_ty_alias_help2)] #[help(query_system_cycle_recursive_ty_alias_help2)]
Ty, Ty,
#[note(query_system::cycle_recursive_trait_alias)] #[note(query_system_cycle_recursive_trait_alias)]
Trait, Trait,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(query_system::cycle_usage)] #[note(query_system_cycle_usage)]
pub struct CycleUsage { pub struct CycleUsage {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -44,7 +44,7 @@ pub struct CycleUsage {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(query_system::cycle, code = "E0391")] #[diag(query_system_cycle, code = "E0391")]
pub struct Cycle { pub struct Cycle {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -60,14 +60,14 @@ pub struct Cycle {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(query_system::reentrant)] #[diag(query_system_reentrant)]
pub struct Reentrant; pub struct Reentrant;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(query_system::increment_compilation)] #[diag(query_system_increment_compilation)]
#[help] #[help]
#[note(query_system::increment_compilation_note1)] #[note(query_system_increment_compilation_note1)]
#[note(query_system::increment_compilation_note2)] #[note(query_system_increment_compilation_note2)]
pub struct IncrementCompilation { pub struct IncrementCompilation {
pub run_cmd: String, pub run_cmd: String,
pub dep_node: String, pub dep_node: String,
@ -75,7 +75,7 @@ pub struct IncrementCompilation {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[help] #[help]
#[diag(query_system::query_overflow)] #[diag(query_system_query_overflow)]
pub struct QueryOverflow { pub struct QueryOverflow {
#[primary_span] #[primary_span]
pub span: Option<Span>, pub span: Option<Span>,
@ -86,7 +86,7 @@ pub struct QueryOverflow {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(query_system::layout_of_depth)] #[note(query_system_layout_of_depth)]
pub struct LayoutOfDepth { pub struct LayoutOfDepth {
pub desc: String, pub desc: String,
pub depth: usize, pub depth: usize,

View File

@ -3,7 +3,7 @@ use rustc_macros::Diagnostic;
use std::path::Path; use std::path::Path;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(save_analysis::could_not_open)] #[diag(save_analysis_could_not_open)]
pub(crate) struct CouldNotOpen<'a> { pub(crate) struct CouldNotOpen<'a> {
pub file_name: &'a Path, pub file_name: &'a Path,
pub err: std::io::Error, pub err: std::io::Error,

View File

@ -7,7 +7,7 @@ use rustc_span::{Span, Symbol};
use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple}; use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple};
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::incorrect_cgu_reuse_type)] #[diag(session_incorrect_cgu_reuse_type)]
pub struct IncorrectCguReuseType<'a> { pub struct IncorrectCguReuseType<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -18,14 +18,14 @@ pub struct IncorrectCguReuseType<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::cgu_not_recorded)] #[diag(session_cgu_not_recorded)]
pub struct CguNotRecorded<'a> { pub struct CguNotRecorded<'a> {
pub cgu_user_name: &'a str, pub cgu_user_name: &'a str,
pub cgu_name: &'a str, pub cgu_name: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::feature_gate_error, code = "E0658")] #[diag(session_feature_gate_error, code = "E0658")]
pub struct FeatureGateError<'a> { pub struct FeatureGateError<'a> {
#[primary_span] #[primary_span]
pub span: MultiSpan, pub span: MultiSpan,
@ -33,99 +33,99 @@ pub struct FeatureGateError<'a> {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(session::feature_diagnostic_for_issue)] #[note(session_feature_diagnostic_for_issue)]
pub struct FeatureDiagnosticForIssue { pub struct FeatureDiagnosticForIssue {
pub n: NonZeroU32, pub n: NonZeroU32,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[help(session::feature_diagnostic_help)] #[help(session_feature_diagnostic_help)]
pub struct FeatureDiagnosticHelp { pub struct FeatureDiagnosticHelp {
pub feature: Symbol, pub feature: Symbol,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::not_circumvent_feature)] #[diag(session_not_circumvent_feature)]
pub struct NotCircumventFeature; pub struct NotCircumventFeature;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::linker_plugin_lto_windows_not_supported)] #[diag(session_linker_plugin_lto_windows_not_supported)]
pub struct LinkerPluginToWindowsNotSupported; pub struct LinkerPluginToWindowsNotSupported;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::profile_use_file_does_not_exist)] #[diag(session_profile_use_file_does_not_exist)]
pub struct ProfileUseFileDoesNotExist<'a> { pub struct ProfileUseFileDoesNotExist<'a> {
pub path: &'a std::path::Path, pub path: &'a std::path::Path,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::profile_sample_use_file_does_not_exist)] #[diag(session_profile_sample_use_file_does_not_exist)]
pub struct ProfileSampleUseFileDoesNotExist<'a> { pub struct ProfileSampleUseFileDoesNotExist<'a> {
pub path: &'a std::path::Path, pub path: &'a std::path::Path,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::target_requires_unwind_tables)] #[diag(session_target_requires_unwind_tables)]
pub struct TargetRequiresUnwindTables; pub struct TargetRequiresUnwindTables;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::sanitizer_not_supported)] #[diag(session_sanitizer_not_supported)]
pub struct SanitizerNotSupported { pub struct SanitizerNotSupported {
pub us: String, pub us: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::sanitizers_not_supported)] #[diag(session_sanitizers_not_supported)]
pub struct SanitizersNotSupported { pub struct SanitizersNotSupported {
pub us: String, pub us: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::cannot_mix_and_match_sanitizers)] #[diag(session_cannot_mix_and_match_sanitizers)]
pub struct CannotMixAndMatchSanitizers { pub struct CannotMixAndMatchSanitizers {
pub first: String, pub first: String,
pub second: String, pub second: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::cannot_enable_crt_static_linux)] #[diag(session_cannot_enable_crt_static_linux)]
pub struct CannotEnableCrtStaticLinux; pub struct CannotEnableCrtStaticLinux;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::sanitizer_cfi_enabled)] #[diag(session_sanitizer_cfi_enabled)]
pub struct SanitizerCfiEnabled; pub struct SanitizerCfiEnabled;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::unstable_virtual_function_elimination)] #[diag(session_unstable_virtual_function_elimination)]
pub struct UnstableVirtualFunctionElimination; pub struct UnstableVirtualFunctionElimination;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::unsupported_dwarf_version)] #[diag(session_unsupported_dwarf_version)]
pub struct UnsupportedDwarfVersion { pub struct UnsupportedDwarfVersion {
pub dwarf_version: u32, pub dwarf_version: u32,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::target_stack_protector_not_supported)] #[diag(session_target_stack_protector_not_supported)]
pub struct StackProtectorNotSupportedForTarget<'a> { pub struct StackProtectorNotSupportedForTarget<'a> {
pub stack_protector: StackProtector, pub stack_protector: StackProtector,
pub target_triple: &'a TargetTriple, pub target_triple: &'a TargetTriple,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::split_debuginfo_unstable_platform)] #[diag(session_split_debuginfo_unstable_platform)]
pub struct SplitDebugInfoUnstablePlatform { pub struct SplitDebugInfoUnstablePlatform {
pub debuginfo: SplitDebuginfo, pub debuginfo: SplitDebuginfo,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::file_is_not_writeable)] #[diag(session_file_is_not_writeable)]
pub struct FileIsNotWriteable<'a> { pub struct FileIsNotWriteable<'a> {
pub file: &'a std::path::Path, pub file: &'a std::path::Path,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::crate_name_does_not_match)] #[diag(session_crate_name_does_not_match)]
pub struct CrateNameDoesNotMatch<'a> { pub struct CrateNameDoesNotMatch<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -134,20 +134,20 @@ pub struct CrateNameDoesNotMatch<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::crate_name_invalid)] #[diag(session_crate_name_invalid)]
pub struct CrateNameInvalid<'a> { pub struct CrateNameInvalid<'a> {
pub s: &'a str, pub s: &'a str,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::crate_name_empty)] #[diag(session_crate_name_empty)]
pub struct CrateNameEmpty { pub struct CrateNameEmpty {
#[primary_span] #[primary_span]
pub span: Option<Span>, pub span: Option<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::invalid_character_in_create_name)] #[diag(session_invalid_character_in_create_name)]
pub struct InvalidCharacterInCrateName<'a> { pub struct InvalidCharacterInCrateName<'a> {
#[primary_span] #[primary_span]
pub span: Option<Span>, pub span: Option<Span>,
@ -156,7 +156,7 @@ pub struct InvalidCharacterInCrateName<'a> {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[multipart_suggestion(session::expr_parentheses_needed, applicability = "machine-applicable")] #[multipart_suggestion(session_expr_parentheses_needed, applicability = "machine-applicable")]
pub struct ExprParenthesesNeeded { pub struct ExprParenthesesNeeded {
#[suggestion_part(code = "(")] #[suggestion_part(code = "(")]
pub left: Span, pub left: Span,
@ -171,7 +171,7 @@ impl ExprParenthesesNeeded {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(session::skipping_const_checks)] #[diag(session_skipping_const_checks)]
pub struct SkippingConstChecks { pub struct SkippingConstChecks {
#[subdiagnostic(eager)] #[subdiagnostic(eager)]
pub unleashed_features: Vec<UnleashedFeatureHelp>, pub unleashed_features: Vec<UnleashedFeatureHelp>,
@ -179,13 +179,13 @@ pub struct SkippingConstChecks {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum UnleashedFeatureHelp { pub enum UnleashedFeatureHelp {
#[help(session::unleashed_feature_help_named)] #[help(session_unleashed_feature_help_named)]
Named { Named {
#[primary_span] #[primary_span]
span: Span, span: Span,
gate: Symbol, gate: Symbol,
}, },
#[help(session::unleashed_feature_help_unnamed)] #[help(session_unleashed_feature_help_unnamed)]
Unnamed { Unnamed {
#[primary_span] #[primary_span]
span: Span, span: Span,

View File

@ -5,7 +5,7 @@ use rustc_macros::Diagnostic;
use rustc_span::Span; use rustc_span::Span;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(symbol_mangling::test_output)] #[diag(symbol_mangling_test_output)]
pub struct TestOutput { pub struct TestOutput {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,

View File

@ -5,7 +5,7 @@ use rustc_session::Limit;
use rustc_span::{Span, Symbol}; use rustc_span::{Span, Symbol};
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(trait_selection::dump_vtable_entries)] #[diag(trait_selection_dump_vtable_entries)]
pub struct DumpVTableEntries<'a> { pub struct DumpVTableEntries<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -14,7 +14,7 @@ pub struct DumpVTableEntries<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(trait_selection::unable_to_construct_constant_value)] #[diag(trait_selection_unable_to_construct_constant_value)]
pub struct UnableToConstructConstantValue<'a> { pub struct UnableToConstructConstantValue<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -23,7 +23,7 @@ pub struct UnableToConstructConstantValue<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[help] #[help]
#[diag(trait_selection::auto_deref_reached_recursion_limit, code = "E0055")] #[diag(trait_selection_auto_deref_reached_recursion_limit, code = "E0055")]
pub struct AutoDerefReachedRecursionLimit<'a> { pub struct AutoDerefReachedRecursionLimit<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
@ -34,7 +34,7 @@ pub struct AutoDerefReachedRecursionLimit<'a> {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(trait_selection::empty_on_clause_in_rustc_on_unimplemented, code = "E0232")] #[diag(trait_selection_empty_on_clause_in_rustc_on_unimplemented, code = "E0232")]
pub struct EmptyOnClauseInOnUnimplemented { pub struct EmptyOnClauseInOnUnimplemented {
#[primary_span] #[primary_span]
#[label] #[label]
@ -42,7 +42,7 @@ pub struct EmptyOnClauseInOnUnimplemented {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(trait_selection::invalid_on_clause_in_rustc_on_unimplemented, code = "E0232")] #[diag(trait_selection_invalid_on_clause_in_rustc_on_unimplemented, code = "E0232")]
pub struct InvalidOnClauseInOnUnimplemented { pub struct InvalidOnClauseInOnUnimplemented {
#[primary_span] #[primary_span]
#[label] #[label]
@ -50,7 +50,7 @@ pub struct InvalidOnClauseInOnUnimplemented {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(trait_selection::no_value_in_rustc_on_unimplemented, code = "E0232")] #[diag(trait_selection_no_value_in_rustc_on_unimplemented, code = "E0232")]
#[note] #[note]
pub struct NoValueInOnUnimplemented { pub struct NoValueInOnUnimplemented {
#[primary_span] #[primary_span]
@ -71,7 +71,7 @@ impl IntoDiagnostic<'_> for NegativePositiveConflict<'_> {
self, self,
handler: &Handler, handler: &Handler,
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> { ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
let mut diag = handler.struct_err(fluent::trait_selection::negative_positive_conflict); let mut diag = handler.struct_err(fluent::trait_selection_negative_positive_conflict);
diag.set_arg("trait_desc", self.trait_desc); diag.set_arg("trait_desc", self.trait_desc);
diag.set_arg( diag.set_arg(
"self_desc", "self_desc",
@ -81,19 +81,19 @@ impl IntoDiagnostic<'_> for NegativePositiveConflict<'_> {
diag.code(rustc_errors::error_code!(E0751)); diag.code(rustc_errors::error_code!(E0751));
match self.negative_impl_span { match self.negative_impl_span {
Ok(span) => { Ok(span) => {
diag.span_label(span, fluent::trait_selection::negative_implementation_here); diag.span_label(span, fluent::negative_implementation_here);
} }
Err(cname) => { Err(cname) => {
diag.note(fluent::trait_selection::negative_implementation_in_crate); diag.note(fluent::negative_implementation_in_crate);
diag.set_arg("negative_impl_cname", cname.to_string()); diag.set_arg("negative_impl_cname", cname.to_string());
} }
} }
match self.positive_impl_span { match self.positive_impl_span {
Ok(span) => { Ok(span) => {
diag.span_label(span, fluent::trait_selection::positive_implementation_here); diag.span_label(span, fluent::positive_implementation_here);
} }
Err(cname) => { Err(cname) => {
diag.note(fluent::trait_selection::positive_implementation_in_crate); diag.note(fluent::positive_implementation_in_crate);
diag.set_arg("positive_impl_cname", cname.to_string()); diag.set_arg("positive_impl_cname", cname.to_string());
} }
} }

View File

@ -5,18 +5,18 @@ use rustc_middle::ty::Ty;
use rustc_span::Span; use rustc_span::Span;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils::needs_drop_overflow)] #[diag(ty_utils_needs_drop_overflow)]
pub struct NeedsDropOverflow<'tcx> { pub struct NeedsDropOverflow<'tcx> {
pub query_ty: Ty<'tcx>, pub query_ty: Ty<'tcx>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(ty_utils::generic_constant_too_complex)] #[diag(ty_utils_generic_constant_too_complex)]
#[help] #[help]
pub struct GenericConstantTooComplex { pub struct GenericConstantTooComplex {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[note(ty_utils::maybe_supported)] #[note(maybe_supported)]
pub maybe_supported: Option<()>, pub maybe_supported: Option<()>,
#[subdiagnostic] #[subdiagnostic]
pub sub: GenericConstantTooComplexSub, pub sub: GenericConstantTooComplexSub,
@ -24,46 +24,46 @@ pub struct GenericConstantTooComplex {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum GenericConstantTooComplexSub { pub enum GenericConstantTooComplexSub {
#[label(ty_utils::borrow_not_supported)] #[label(ty_utils_borrow_not_supported)]
BorrowNotSupported(#[primary_span] Span), BorrowNotSupported(#[primary_span] Span),
#[label(ty_utils::address_and_deref_not_supported)] #[label(ty_utils_address_and_deref_not_supported)]
AddressAndDerefNotSupported(#[primary_span] Span), AddressAndDerefNotSupported(#[primary_span] Span),
#[label(ty_utils::array_not_supported)] #[label(ty_utils_array_not_supported)]
ArrayNotSupported(#[primary_span] Span), ArrayNotSupported(#[primary_span] Span),
#[label(ty_utils::block_not_supported)] #[label(ty_utils_block_not_supported)]
BlockNotSupported(#[primary_span] Span), BlockNotSupported(#[primary_span] Span),
#[label(ty_utils::never_to_any_not_supported)] #[label(ty_utils_never_to_any_not_supported)]
NeverToAnyNotSupported(#[primary_span] Span), NeverToAnyNotSupported(#[primary_span] Span),
#[label(ty_utils::tuple_not_supported)] #[label(ty_utils_tuple_not_supported)]
TupleNotSupported(#[primary_span] Span), TupleNotSupported(#[primary_span] Span),
#[label(ty_utils::index_not_supported)] #[label(ty_utils_index_not_supported)]
IndexNotSupported(#[primary_span] Span), IndexNotSupported(#[primary_span] Span),
#[label(ty_utils::field_not_supported)] #[label(ty_utils_field_not_supported)]
FieldNotSupported(#[primary_span] Span), FieldNotSupported(#[primary_span] Span),
#[label(ty_utils::const_block_not_supported)] #[label(ty_utils_const_block_not_supported)]
ConstBlockNotSupported(#[primary_span] Span), ConstBlockNotSupported(#[primary_span] Span),
#[label(ty_utils::adt_not_supported)] #[label(ty_utils_adt_not_supported)]
AdtNotSupported(#[primary_span] Span), AdtNotSupported(#[primary_span] Span),
#[label(ty_utils::pointer_not_supported)] #[label(ty_utils_pointer_not_supported)]
PointerNotSupported(#[primary_span] Span), PointerNotSupported(#[primary_span] Span),
#[label(ty_utils::yield_not_supported)] #[label(ty_utils_yield_not_supported)]
YieldNotSupported(#[primary_span] Span), YieldNotSupported(#[primary_span] Span),
#[label(ty_utils::loop_not_supported)] #[label(ty_utils_loop_not_supported)]
LoopNotSupported(#[primary_span] Span), LoopNotSupported(#[primary_span] Span),
#[label(ty_utils::box_not_supported)] #[label(ty_utils_box_not_supported)]
BoxNotSupported(#[primary_span] Span), BoxNotSupported(#[primary_span] Span),
#[label(ty_utils::binary_not_supported)] #[label(ty_utils_binary_not_supported)]
BinaryNotSupported(#[primary_span] Span), BinaryNotSupported(#[primary_span] Span),
#[label(ty_utils::logical_op_not_supported)] #[label(ty_utils_logical_op_not_supported)]
LogicalOpNotSupported(#[primary_span] Span), LogicalOpNotSupported(#[primary_span] Span),
#[label(ty_utils::assign_not_supported)] #[label(ty_utils_assign_not_supported)]
AssignNotSupported(#[primary_span] Span), AssignNotSupported(#[primary_span] Span),
#[label(ty_utils::closure_and_return_not_supported)] #[label(ty_utils_closure_and_return_not_supported)]
ClosureAndReturnNotSupported(#[primary_span] Span), ClosureAndReturnNotSupported(#[primary_span] Span),
#[label(ty_utils::control_flow_not_supported)] #[label(ty_utils_control_flow_not_supported)]
ControlFlowNotSupported(#[primary_span] Span), ControlFlowNotSupported(#[primary_span] Span),
#[label(ty_utils::inline_asm_not_supported)] #[label(ty_utils_inline_asm_not_supported)]
InlineAsmNotSupported(#[primary_span] Span), InlineAsmNotSupported(#[primary_span] Span),
#[label(ty_utils::operation_not_supported)] #[label(ty_utils_operation_not_supported)]
OperationNotSupported(#[primary_span] Span), OperationNotSupported(#[primary_span] Span),
} }