mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
Stop using String
for error codes.
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
This commit is contained in:
parent
0321de2778
commit
5d9dfbd08f
@ -1268,7 +1268,6 @@ name = "error_index_generator"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"mdbook",
|
||||
"rustc_error_codes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3701,7 +3700,6 @@ dependencies = [
|
||||
"rustc_codegen_ssa",
|
||||
"rustc_const_eval",
|
||||
"rustc_data_structures",
|
||||
"rustc_error_codes",
|
||||
"rustc_errors",
|
||||
"rustc_expand",
|
||||
"rustc_feature",
|
||||
@ -3774,9 +3772,11 @@ dependencies = [
|
||||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_data_structures",
|
||||
"rustc_error_codes",
|
||||
"rustc_error_messages",
|
||||
"rustc_fluent_macro",
|
||||
"rustc_hir",
|
||||
"rustc_index",
|
||||
"rustc_lint_defs",
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
|
@ -1,9 +1,9 @@
|
||||
use rustc_errors::DiagnosticArgFromDisplay;
|
||||
use rustc_errors::{codes::*, DiagnosticArgFromDisplay};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_span::{symbol::Ident, Span, Symbol};
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -22,7 +22,7 @@ pub struct UseAngleBrackets {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_lowering_invalid_abi, code = "E0703")]
|
||||
#[diag(ast_lowering_invalid_abi, code = E0703)]
|
||||
#[note]
|
||||
pub struct InvalidAbi {
|
||||
#[primary_span]
|
||||
@ -89,7 +89,7 @@ pub enum AssocTyParenthesesSub {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_lowering_misplaced_impl_trait, code = "E0562")]
|
||||
#[diag(ast_lowering_misplaced_impl_trait, code = E0562)]
|
||||
#[note]
|
||||
pub struct MisplacedImplTrait<'a> {
|
||||
#[primary_span]
|
||||
@ -114,7 +114,7 @@ pub struct UnderscoreExprLhsAssign {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic, Clone, Copy)]
|
||||
#[diag(ast_lowering_base_expression_double_dot, code = "E0797")]
|
||||
#[diag(ast_lowering_base_expression_double_dot, code = E0797)]
|
||||
pub struct BaseExpressionDoubleDot {
|
||||
#[primary_span]
|
||||
#[suggestion(code = "/* expr */", applicability = "has-placeholders", style = "verbose")]
|
||||
@ -122,7 +122,7 @@ pub struct BaseExpressionDoubleDot {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -132,14 +132,14 @@ pub struct AwaitOnlyInAsyncFnAndBlocks {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic, Clone, Copy)]
|
||||
#[diag(ast_lowering_coroutine_too_many_parameters, code = "E0628")]
|
||||
#[diag(ast_lowering_coroutine_too_many_parameters, code = E0628)]
|
||||
pub struct CoroutineTooManyParameters {
|
||||
#[primary_span]
|
||||
pub fn_decl_span: Span,
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
pub fn_decl_span: Span,
|
||||
@ -154,14 +154,14 @@ pub struct FunctionalRecordUpdateDestructuringAssignment {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic, Clone, Copy)]
|
||||
#[diag(ast_lowering_async_coroutines_not_supported, code = "E0727")]
|
||||
#[diag(ast_lowering_async_coroutines_not_supported, code = E0727)]
|
||||
pub struct AsyncCoroutinesNotSupported {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Errors emitted by ast_passes.
|
||||
|
||||
use rustc_ast::ParamKindOrd;
|
||||
use rustc_errors::{AddToDiagnostic, Applicability};
|
||||
use rustc_errors::{codes::*, AddToDiagnostic, Applicability};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_span::{symbol::Ident, Span, Symbol};
|
||||
|
||||
@ -23,7 +23,7 @@ pub struct InvalidLabel {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_visibility_not_permitted, code = "E0449")]
|
||||
#[diag(ast_passes_visibility_not_permitted, code = E0449)]
|
||||
pub struct VisibilityNotPermitted {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -44,7 +44,7 @@ pub enum VisibilityNotPermittedNote {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_trait_fn_const, code = "E0379")]
|
||||
#[diag(ast_passes_trait_fn_const, code = E0379)]
|
||||
pub struct TraitFnConst {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -302,14 +302,14 @@ pub struct ItemUnderscore<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_nomangle_ascii, code = "E0754")]
|
||||
#[diag(ast_passes_nomangle_ascii, code = E0754)]
|
||||
pub struct NoMangleAscii {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_module_nonascii, code = "E0754")]
|
||||
#[diag(ast_passes_module_nonascii, code = E0754)]
|
||||
#[help]
|
||||
pub struct ModuleNonAscii {
|
||||
#[primary_span]
|
||||
@ -318,7 +318,7 @@ pub struct ModuleNonAscii {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_auto_generic, code = "E0567")]
|
||||
#[diag(ast_passes_auto_generic, code = E0567)]
|
||||
pub struct AutoTraitGeneric {
|
||||
#[primary_span]
|
||||
#[suggestion(code = "", applicability = "machine-applicable")]
|
||||
@ -328,7 +328,7 @@ pub struct AutoTraitGeneric {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_auto_super_lifetime, code = "E0568")]
|
||||
#[diag(ast_passes_auto_super_lifetime, code = E0568)]
|
||||
pub struct AutoTraitBounds {
|
||||
#[primary_span]
|
||||
#[suggestion(code = "", applicability = "machine-applicable")]
|
||||
@ -338,7 +338,7 @@ pub struct AutoTraitBounds {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_auto_items, code = "E0380")]
|
||||
#[diag(ast_passes_auto_items, code = E0380)]
|
||||
pub struct AutoTraitItems {
|
||||
#[primary_span]
|
||||
pub spans: Vec<Span>,
|
||||
@ -384,28 +384,28 @@ impl AddToDiagnostic for EmptyLabelManySpans {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_pattern_in_fn_pointer, code = "E0561")]
|
||||
#[diag(ast_passes_pattern_in_fn_pointer, code = E0561)]
|
||||
pub struct PatternFnPointer {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_trait_object_single_bound, code = "E0226")]
|
||||
#[diag(ast_passes_trait_object_single_bound, code = E0226)]
|
||||
pub struct TraitObjectBound {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_impl_trait_path, code = "E0667")]
|
||||
#[diag(ast_passes_impl_trait_path, code = E0667)]
|
||||
pub struct ImplTraitPath {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_nested_impl_trait, code = "E0666")]
|
||||
#[diag(ast_passes_nested_impl_trait, code = E0666)]
|
||||
pub struct NestedImplTrait {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -443,7 +443,7 @@ pub struct ObsoleteAuto {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_unsafe_negative_impl, code = "E0198")]
|
||||
#[diag(ast_passes_unsafe_negative_impl, code = E0198)]
|
||||
pub struct UnsafeNegativeImpl {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -468,7 +468,7 @@ pub struct InherentImplCannot<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_inherent_cannot_be, code = "E0197")]
|
||||
#[diag(ast_passes_inherent_cannot_be, code = E0197)]
|
||||
pub struct InherentImplCannotUnsafe<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -536,7 +536,7 @@ pub struct GenericDefaultTrailing {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_nested_lifetimes, code = "E0316")]
|
||||
#[diag(ast_passes_nested_lifetimes, code = E0316)]
|
||||
pub struct NestedLifetimes {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -655,7 +655,7 @@ pub struct ConstAndCVariadic {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_pattern_in_foreign, code = "E0130")]
|
||||
#[diag(ast_passes_pattern_in_foreign, code = E0130)]
|
||||
pub struct PatternInForeign {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -663,7 +663,7 @@ pub struct PatternInForeign {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_pattern_in_bodiless, code = "E0642")]
|
||||
#[diag(ast_passes_pattern_in_bodiless, code = E0642)]
|
||||
pub struct PatternInBodiless {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -711,14 +711,14 @@ pub struct AssociatedSuggestion2 {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_stability_outside_std, code = "E0734")]
|
||||
#[diag(ast_passes_stability_outside_std, code = E0734)]
|
||||
pub struct StabilityOutsideStd {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_feature_on_non_nightly, code = "E0554")]
|
||||
#[diag(ast_passes_feature_on_non_nightly, code = E0554)]
|
||||
pub struct FeatureOnNonNightly {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -2,8 +2,7 @@ use std::num::IntErrorKind;
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_errors::{
|
||||
error_code, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
|
||||
Level,
|
||||
codes::*, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_span::{Span, Symbol};
|
||||
@ -12,14 +11,14 @@ use crate::fluent_generated as fluent;
|
||||
use crate::UnsupportedLiteralReason;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_expected_one_cfg_pattern, code = "E0536")]
|
||||
#[diag(attr_expected_one_cfg_pattern, code = E0536)]
|
||||
pub(crate) struct ExpectedOneCfgPattern {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_invalid_predicate, code = "E0537")]
|
||||
#[diag(attr_invalid_predicate, code = E0537)]
|
||||
pub(crate) struct InvalidPredicate {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -28,7 +27,7 @@ pub(crate) struct InvalidPredicate {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_multiple_item, code = "E0538")]
|
||||
#[diag(attr_multiple_item, code = E0538)]
|
||||
pub(crate) struct MultipleItem {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -37,7 +36,7 @@ pub(crate) struct MultipleItem {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_incorrect_meta_item, code = "E0539")]
|
||||
#[diag(attr_incorrect_meta_item, code = E0539)]
|
||||
pub(crate) struct IncorrectMetaItem {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -56,7 +55,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UnknownMetaItem<'_> {
|
||||
let expected = self.expected.iter().map(|name| format!("`{name}`")).collect::<Vec<_>>();
|
||||
DiagnosticBuilder::new(dcx, level, fluent::attr_unknown_meta_item)
|
||||
.with_span(self.span)
|
||||
.with_code(error_code!(E0541))
|
||||
.with_code(E0541)
|
||||
.with_arg("item", self.item)
|
||||
.with_arg("expected", expected.join(", "))
|
||||
.with_span_label(self.span, fluent::attr_label)
|
||||
@ -64,28 +63,28 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UnknownMetaItem<'_> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_missing_since, code = "E0542")]
|
||||
#[diag(attr_missing_since, code = E0542)]
|
||||
pub(crate) struct MissingSince {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_missing_note, code = "E0543")]
|
||||
#[diag(attr_missing_note, code = E0543)]
|
||||
pub(crate) struct MissingNote {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_multiple_stability_levels, code = "E0544")]
|
||||
#[diag(attr_multiple_stability_levels, code = E0544)]
|
||||
pub(crate) struct MultipleStabilityLevels {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_invalid_issue_string, code = "E0545")]
|
||||
#[diag(attr_invalid_issue_string, code = E0545)]
|
||||
pub(crate) struct InvalidIssueString {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -143,21 +142,21 @@ impl InvalidIssueStringCause {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_missing_feature, code = "E0546")]
|
||||
#[diag(attr_missing_feature, code = E0546)]
|
||||
pub(crate) struct MissingFeature {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_non_ident_feature, code = "E0546")]
|
||||
#[diag(attr_non_ident_feature, code = E0546)]
|
||||
pub(crate) struct NonIdentFeature {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_missing_issue, code = "E0547")]
|
||||
#[diag(attr_missing_issue, code = E0547)]
|
||||
pub(crate) struct MissingIssue {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -166,14 +165,14 @@ pub(crate) struct MissingIssue {
|
||||
// FIXME: Why is this the same error code as `InvalidReprHintNoParen` and `InvalidReprHintNoValue`?
|
||||
// It is more similar to `IncorrectReprFormatGeneric`.
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_invalid_repr_hint_no_paren, code = "E0552")]
|
||||
#[diag(attr_invalid_repr_hint_no_paren, code = E0552)]
|
||||
pub(crate) struct InvalidReprHintNoParen {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -182,7 +181,7 @@ pub(crate) struct InvalidReprHintNoParen {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_invalid_repr_hint_no_value, code = "E0552")]
|
||||
#[diag(attr_invalid_repr_hint_no_value, code = E0552)]
|
||||
pub(crate) struct InvalidReprHintNoValue {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -215,7 +214,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UnsupportedLiteral {
|
||||
},
|
||||
);
|
||||
diag.span(self.span);
|
||||
diag.code(error_code!(E0565));
|
||||
diag.code(E0565);
|
||||
if self.is_bytestr {
|
||||
diag.span_suggestion(
|
||||
self.start_point_span,
|
||||
@ -229,7 +228,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UnsupportedLiteral {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_invalid_repr_align_need_arg, code = "E0589")]
|
||||
#[diag(attr_invalid_repr_align_need_arg, code = E0589)]
|
||||
pub(crate) struct InvalidReprAlignNeedArg {
|
||||
#[primary_span]
|
||||
#[suggestion(code = "align(...)", applicability = "has-placeholders")]
|
||||
@ -237,7 +236,7 @@ pub(crate) struct InvalidReprAlignNeedArg {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_invalid_repr_generic, code = "E0589")]
|
||||
#[diag(attr_invalid_repr_generic, code = E0589)]
|
||||
pub(crate) struct InvalidReprGeneric<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -247,14 +246,14 @@ pub(crate) struct InvalidReprGeneric<'a> {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_incorrect_repr_format_generic, code = "E0693")]
|
||||
#[diag(attr_incorrect_repr_format_generic, code = E0693)]
|
||||
pub(crate) struct IncorrectReprFormatGeneric<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -305,14 +304,14 @@ impl<'a> IncorrectReprFormatGenericCause<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_rustc_promotable_pairing, code = "E0717")]
|
||||
#[diag(attr_rustc_promotable_pairing, code = E0717)]
|
||||
pub(crate) struct RustcPromotablePairing {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(attr_rustc_allowed_unstable_pairing, code = "E0789")]
|
||||
#[diag(attr_rustc_allowed_unstable_pairing, code = E0789)]
|
||||
pub(crate) struct RustcAllowedUnstablePairing {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -1,4 +1,4 @@
|
||||
use rustc_errors::{struct_span_code_err, DiagCtxt, DiagnosticBuilder};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, DiagCtxt, DiagnosticBuilder};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
|
||||
|
@ -3,7 +3,9 @@
|
||||
use either::Either;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan};
|
||||
use rustc_errors::{
|
||||
codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::intravisit::{walk_block, walk_expr, Visitor};
|
||||
|
@ -1,4 +1,4 @@
|
||||
use rustc_errors::MultiSpan;
|
||||
use rustc_errors::{codes::*, MultiSpan};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::{GenericArg, Ty};
|
||||
use rustc_span::Span;
|
||||
@ -6,7 +6,7 @@ use rustc_span::Span;
|
||||
use crate::diagnostics::RegionName;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(borrowck_move_unsized, code = "E0161")]
|
||||
#[diag(borrowck_move_unsized, code = E0161)]
|
||||
pub(crate) struct MoveUnsized<'tcx> {
|
||||
pub ty: Ty<'tcx>,
|
||||
#[primary_span]
|
||||
@ -281,7 +281,7 @@ pub(crate) enum CaptureVarCause {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(borrowck_cannot_move_when_borrowed, code = "E0505")]
|
||||
#[diag(borrowck_cannot_move_when_borrowed, code = E0505)]
|
||||
pub(crate) struct MoveBorrow<'a> {
|
||||
pub place: &'a str,
|
||||
pub borrow_place: &'a str,
|
||||
@ -294,7 +294,7 @@ pub(crate) struct MoveBorrow<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(borrowck_opaque_type_non_generic_param, code = "E0792")]
|
||||
#[diag(borrowck_opaque_type_non_generic_param, code = E0792)]
|
||||
pub(crate) struct NonGenericOpaqueTypeParam<'a, 'tcx> {
|
||||
pub ty: GenericArg<'tcx>,
|
||||
pub kind: &'a str,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_errors::{
|
||||
AddToDiagnostic, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
MultiSpan, SingleLabelManySpans,
|
||||
codes::*, AddToDiagnostic, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
|
||||
Level, MultiSpan, SingleLabelManySpans,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_span::{symbol::Ident, Span, Symbol};
|
||||
@ -269,7 +269,7 @@ pub(crate) struct ConcatIdentsIdentArgs {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_bad_derive_target, code = "E0774")]
|
||||
#[diag(builtin_macros_bad_derive_target, code = E0774)]
|
||||
pub(crate) struct BadDeriveTarget {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -283,7 +283,7 @@ pub(crate) struct BadDeriveTarget {
|
||||
pub(crate) struct TestsNotSupport {}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_unexpected_lit, code = "E0777")]
|
||||
#[diag(builtin_macros_unexpected_lit, code = E0777)]
|
||||
pub(crate) struct BadDeriveLit {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
|
@ -15,7 +15,7 @@ use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::emitter::Emitter;
|
||||
use rustc_errors::{translation::Translate, DiagCtxt, FatalError, Level};
|
||||
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, Style};
|
||||
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, ErrCode, Style};
|
||||
use rustc_fs_util::link_or_copy;
|
||||
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||
use rustc_incremental::{
|
||||
@ -1000,7 +1000,7 @@ type DiagnosticArgName<'source> = Cow<'source, str>;
|
||||
struct Diagnostic {
|
||||
msgs: Vec<(DiagnosticMessage, Style)>,
|
||||
args: FxHashMap<DiagnosticArgName<'static>, rustc_errors::DiagnosticArgValue<'static>>,
|
||||
code: Option<String>,
|
||||
code: Option<ErrCode>,
|
||||
lvl: Level,
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_ast::{ast, attr, MetaItemKind, NestedMetaItem};
|
||||
use rustc_attr::{list_contains_name, InlineAttr, InstructionSetAttr, OptimizeAttr};
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
|
||||
|
@ -4,7 +4,7 @@ use crate::assert_module_sources::CguReuse;
|
||||
use crate::back::command::Command;
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{
|
||||
DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
|
||||
codes::*, DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
|
||||
IntoDiagnosticArg, Level,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
@ -612,7 +612,7 @@ pub struct UnknownAtomicOperation;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum InvalidMonomorphization<'tcx> {
|
||||
#[diag(codegen_ssa_invalid_monomorphization_basic_integer_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_basic_integer_type, code = E0511)]
|
||||
BasicIntegerType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -620,7 +620,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_basic_float_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_basic_float_type, code = E0511)]
|
||||
BasicFloatType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -628,14 +628,14 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_float_to_int_unchecked, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_float_to_int_unchecked, code = E0511)]
|
||||
FloatToIntUnchecked {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_floating_point_vector, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_floating_point_vector, code = E0511)]
|
||||
FloatingPointVector {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -644,7 +644,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
in_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_floating_point_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_floating_point_type, code = E0511)]
|
||||
FloatingPointType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -652,14 +652,14 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
in_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unrecognized_intrinsic, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unrecognized_intrinsic, code = E0511)]
|
||||
UnrecognizedIntrinsic {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
name: Symbol,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_argument, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_argument, code = E0511)]
|
||||
SimdArgument {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -667,7 +667,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_input, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_input, code = E0511)]
|
||||
SimdInput {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -675,7 +675,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_first, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_first, code = E0511)]
|
||||
SimdFirst {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -683,7 +683,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_second, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_second, code = E0511)]
|
||||
SimdSecond {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -691,7 +691,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_third, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_third, code = E0511)]
|
||||
SimdThird {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -699,7 +699,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_return, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_return, code = E0511)]
|
||||
SimdReturn {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -707,7 +707,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_invalid_bitmask, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_invalid_bitmask, code = E0511)]
|
||||
InvalidBitmask {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -717,7 +717,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
expected_bytes: u64,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_length_input_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_length_input_type, code = E0511)]
|
||||
ReturnLengthInputType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -728,7 +728,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
out_len: u64,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_second_argument_length, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_second_argument_length, code = E0511)]
|
||||
SecondArgumentLength {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -739,7 +739,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
out_len: u64,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_third_argument_length, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_third_argument_length, code = E0511)]
|
||||
ThirdArgumentLength {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -750,7 +750,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
out_len: u64,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_integer_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_integer_type, code = E0511)]
|
||||
ReturnIntegerType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -759,7 +759,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
out_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_shuffle, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_simd_shuffle, code = E0511)]
|
||||
SimdShuffle {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -767,7 +767,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_length, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_length, code = E0511)]
|
||||
ReturnLength {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -777,7 +777,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
out_len: u64,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_element, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_element, code = E0511)]
|
||||
ReturnElement {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -788,7 +788,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
out_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_shuffle_index_not_constant, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_shuffle_index_not_constant, code = E0511)]
|
||||
ShuffleIndexNotConstant {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -796,7 +796,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
arg_idx: u64,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_shuffle_index_out_of_bounds, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_shuffle_index_out_of_bounds, code = E0511)]
|
||||
ShuffleIndexOutOfBounds {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -805,7 +805,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
total_len: u128,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_inserted_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_inserted_type, code = E0511)]
|
||||
InsertedType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -815,7 +815,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
out_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_return_type, code = E0511)]
|
||||
ReturnType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -825,7 +825,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ret_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_return_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_return_type, code = E0511)]
|
||||
ExpectedReturnType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -834,7 +834,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ret_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_mismatched_lengths, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_mismatched_lengths, code = E0511)]
|
||||
MismatchedLengths {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -843,7 +843,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
v_len: u64,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_mask_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_mask_type, code = E0511)]
|
||||
MaskType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -851,7 +851,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_vector_argument, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_vector_argument, code = E0511)]
|
||||
VectorArgument {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -860,7 +860,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
in_elem: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_cannot_return, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_cannot_return, code = E0511)]
|
||||
CannotReturn {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -870,7 +870,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
expected_bytes: u64,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_element_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_element_type, code = E0511)]
|
||||
ExpectedElementType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -882,7 +882,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
mutability: ExpectedPointerMutability,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_third_arg_element_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_third_arg_element_type, code = E0511)]
|
||||
ThirdArgElementType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -891,7 +891,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
third_arg: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol_of_size, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol_of_size, code = E0511)]
|
||||
UnsupportedSymbolOfSize {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -903,7 +903,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ret_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol, code = E0511)]
|
||||
UnsupportedSymbol {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -914,7 +914,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ret_ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_cast_fat_pointer, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_cast_fat_pointer, code = E0511)]
|
||||
CastFatPointer {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -922,7 +922,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_pointer, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_pointer, code = E0511)]
|
||||
ExpectedPointer {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -930,7 +930,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_usize, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_usize, code = E0511)]
|
||||
ExpectedUsize {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -938,7 +938,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unsupported_cast, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unsupported_cast, code = E0511)]
|
||||
UnsupportedCast {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -949,7 +949,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
out_elem: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unsupported_operation, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_unsupported_operation, code = E0511)]
|
||||
UnsupportedOperation {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -958,7 +958,7 @@ pub enum InvalidMonomorphization<'tcx> {
|
||||
in_elem: Ty<'tcx>,
|
||||
},
|
||||
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_vector_element_type, code = "E0511")]
|
||||
#[diag(codegen_ssa_invalid_monomorphization_expected_vector_element_type, code = E0511)]
|
||||
ExpectedVectorElementType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
|
@ -1,8 +1,8 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use rustc_errors::{
|
||||
DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee,
|
||||
IntoDiagnostic, Level,
|
||||
codes::*, DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, DiagnosticMessage,
|
||||
EmissionGuarantee, IntoDiagnostic, Level,
|
||||
};
|
||||
use rustc_hir::ConstContext;
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
@ -55,14 +55,14 @@ pub(crate) struct UnstableInStable {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_thread_local_access, code = "E0625")]
|
||||
#[diag(const_eval_thread_local_access, code = E0625)]
|
||||
pub(crate) struct NonConstOpErr {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_static_access, code = "E0013")]
|
||||
#[diag(const_eval_static_access, code = E0013)]
|
||||
#[help]
|
||||
pub(crate) struct StaticAccessErr {
|
||||
#[primary_span]
|
||||
@ -98,7 +98,7 @@ pub(crate) struct PanicNonStrErr {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_mut_deref, code = "E0658")]
|
||||
#[diag(const_eval_mut_deref, code = E0658)]
|
||||
pub(crate) struct MutDerefErr {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -106,7 +106,7 @@ pub(crate) struct MutDerefErr {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_transient_mut_borrow, code = "E0658")]
|
||||
#[diag(const_eval_transient_mut_borrow, code = E0658)]
|
||||
pub(crate) struct TransientMutBorrowErr {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -114,7 +114,7 @@ pub(crate) struct TransientMutBorrowErr {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_transient_mut_raw, code = "E0658")]
|
||||
#[diag(const_eval_transient_mut_raw, code = E0658)]
|
||||
pub(crate) struct TransientMutRawErr {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -146,7 +146,7 @@ pub(crate) struct UnstableConstFn {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_unallowed_mutable_refs, code = "E0764")]
|
||||
#[diag(const_eval_unallowed_mutable_refs, code = E0764)]
|
||||
pub(crate) struct UnallowedMutableRefs {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -156,7 +156,7 @@ pub(crate) struct UnallowedMutableRefs {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_unallowed_mutable_raw, code = "E0764")]
|
||||
#[diag(const_eval_unallowed_mutable_raw, code = E0764)]
|
||||
pub(crate) struct UnallowedMutableRaw {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -165,7 +165,7 @@ pub(crate) struct UnallowedMutableRaw {
|
||||
pub teach: Option<()>,
|
||||
}
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -173,7 +173,7 @@ pub(crate) struct NonConstFmtMacroCall {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_non_const_fn_call, code = "E0015")]
|
||||
#[diag(const_eval_non_const_fn_call, code = E0015)]
|
||||
pub(crate) struct NonConstFnCall {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -190,7 +190,7 @@ pub(crate) struct UnallowedOpInConstContext {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_unallowed_heap_allocations, code = "E0010")]
|
||||
#[diag(const_eval_unallowed_heap_allocations, code = E0010)]
|
||||
pub(crate) struct UnallowedHeapAllocations {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -201,7 +201,7 @@ pub(crate) struct UnallowedHeapAllocations {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_unallowed_inline_asm, code = "E0015")]
|
||||
#[diag(const_eval_unallowed_inline_asm, code = E0015)]
|
||||
pub(crate) struct UnallowedInlineAsm {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -209,7 +209,7 @@ pub(crate) struct UnallowedInlineAsm {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_interior_mutable_data_refer, code = "E0492")]
|
||||
#[diag(const_eval_interior_mutable_data_refer, code = E0492)]
|
||||
pub(crate) struct InteriorMutableDataRefer {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -274,7 +274,7 @@ pub struct RawBytesNote {
|
||||
// FIXME(fee1-dead) do not use stringly typed `ConstContext`
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_match_eq_non_const, code = "E0015")]
|
||||
#[diag(const_eval_match_eq_non_const, code = E0015)]
|
||||
#[note]
|
||||
pub struct NonConstMatchEq<'tcx> {
|
||||
#[primary_span]
|
||||
@ -284,7 +284,7 @@ pub struct NonConstMatchEq<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_for_loop_into_iter_non_const, code = "E0015")]
|
||||
#[diag(const_eval_for_loop_into_iter_non_const, code = E0015)]
|
||||
pub struct NonConstForLoopIntoIter<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -293,7 +293,7 @@ pub struct NonConstForLoopIntoIter<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_question_branch_non_const, code = "E0015")]
|
||||
#[diag(const_eval_question_branch_non_const, code = E0015)]
|
||||
pub struct NonConstQuestionBranch<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -302,7 +302,7 @@ pub struct NonConstQuestionBranch<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_question_from_residual_non_const, code = "E0015")]
|
||||
#[diag(const_eval_question_from_residual_non_const, code = E0015)]
|
||||
pub struct NonConstQuestionFromResidual<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -311,7 +311,7 @@ pub struct NonConstQuestionFromResidual<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_try_block_from_output_non_const, code = "E0015")]
|
||||
#[diag(const_eval_try_block_from_output_non_const, code = E0015)]
|
||||
pub struct NonConstTryBlockFromOutput<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -320,7 +320,7 @@ pub struct NonConstTryBlockFromOutput<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_await_non_const, code = "E0015")]
|
||||
#[diag(const_eval_await_non_const, code = E0015)]
|
||||
pub struct NonConstAwait<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -329,7 +329,7 @@ pub struct NonConstAwait<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_closure_non_const, code = "E0015")]
|
||||
#[diag(const_eval_closure_non_const, code = E0015)]
|
||||
pub struct NonConstClosure {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -362,7 +362,7 @@ pub struct ConsiderDereferencing {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_operator_non_const, code = "E0015")]
|
||||
#[diag(const_eval_operator_non_const, code = E0015)]
|
||||
pub struct NonConstOperator {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -372,7 +372,7 @@ pub struct NonConstOperator {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_deref_coercion_non_const, code = "E0015")]
|
||||
#[diag(const_eval_deref_coercion_non_const, code = E0015)]
|
||||
#[note]
|
||||
pub struct NonConstDerefCoercion<'tcx> {
|
||||
#[primary_span]
|
||||
@ -385,7 +385,7 @@ pub struct NonConstDerefCoercion<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_live_drop, code = "E0493")]
|
||||
#[diag(const_eval_live_drop, code = E0493)]
|
||||
pub struct LiveDrop<'tcx> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -397,7 +397,7 @@ pub struct LiveDrop<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_error, code = "E0080")]
|
||||
#[diag(const_eval_error, code = E0080)]
|
||||
pub struct ConstEvalError {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -423,7 +423,7 @@ pub struct NullaryIntrinsicError {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(const_eval_undefined_behavior, code = "E0080")]
|
||||
#[diag(const_eval_undefined_behavior, code = E0080)]
|
||||
pub struct UndefinedBehavior {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use hir::def_id::LocalDefId;
|
||||
use hir::{ConstContext, LangItem};
|
||||
use rustc_errors::{error_code, DiagnosticBuilder};
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
@ -372,7 +372,7 @@ impl<'tcx> NonConstOp<'tcx> for HeapAllocation {
|
||||
ccx.dcx().create_err(errors::UnallowedHeapAllocations {
|
||||
span,
|
||||
kind: ccx.const_kind(),
|
||||
teach: ccx.tcx.sess.teach(&error_code!(E0010)).then_some(()),
|
||||
teach: ccx.tcx.sess.teach(E0010).then_some(()),
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -434,14 +434,14 @@ impl<'tcx> NonConstOp<'tcx> for CellBorrow {
|
||||
span,
|
||||
opt_help: Some(()),
|
||||
kind: ccx.const_kind(),
|
||||
teach: ccx.tcx.sess.teach(&error_code!(E0492)).then_some(()),
|
||||
teach: ccx.tcx.sess.teach(E0492).then_some(()),
|
||||
})
|
||||
} else {
|
||||
ccx.dcx().create_err(errors::InteriorMutableDataRefer {
|
||||
span,
|
||||
opt_help: None,
|
||||
kind: ccx.const_kind(),
|
||||
teach: ccx.tcx.sess.teach(&error_code!(E0492)).then_some(()),
|
||||
teach: ccx.tcx.sess.teach(E0492).then_some(()),
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -469,12 +469,12 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow {
|
||||
hir::BorrowKind::Raw => ccx.tcx.dcx().create_err(errors::UnallowedMutableRaw {
|
||||
span,
|
||||
kind: ccx.const_kind(),
|
||||
teach: ccx.tcx.sess.teach(&error_code!(E0764)).then_some(()),
|
||||
teach: ccx.tcx.sess.teach(E0764).then_some(()),
|
||||
}),
|
||||
hir::BorrowKind::Ref => ccx.dcx().create_err(errors::UnallowedMutableRefs {
|
||||
span,
|
||||
kind: ccx.const_kind(),
|
||||
teach: ccx.tcx.sess.teach(&error_code!(E0764)).then_some(()),
|
||||
teach: ccx.tcx.sess.teach(E0764).then_some(()),
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -588,7 +588,7 @@ impl<'tcx> NonConstOp<'tcx> for StaticAccess {
|
||||
ccx.dcx().create_err(errors::StaticAccessErr {
|
||||
span,
|
||||
kind: ccx.const_kind(),
|
||||
teach: ccx.tcx.sess.teach(&error_code!(E0013)).then_some(()),
|
||||
teach: ccx.tcx.sess.teach(E0013).then_some(()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ rustc_builtin_macros = { path = "../rustc_builtin_macros" }
|
||||
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
|
||||
rustc_const_eval = { path = "../rustc_const_eval" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_error_codes = { path = "../rustc_error_codes" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_expand = { path = "../rustc_expand" }
|
||||
rustc_feature = { path = "../rustc_feature" }
|
||||
|
@ -23,9 +23,8 @@ use rustc_codegen_ssa::{traits::CodegenBackend, CodegenErrors, CodegenResults};
|
||||
use rustc_data_structures::profiling::{
|
||||
get_resident_set_size, print_time_passes_entry, TimePassesFormat,
|
||||
};
|
||||
use rustc_errors::registry::{InvalidErrorCode, Registry};
|
||||
use rustc_errors::{markdown, ColorConfig};
|
||||
use rustc_errors::{DiagCtxt, ErrorGuaranteed, PResult};
|
||||
use rustc_errors::registry::Registry;
|
||||
use rustc_errors::{markdown, ColorConfig, DiagCtxt, ErrCode, ErrorGuaranteed, PResult};
|
||||
use rustc_feature::find_gated_cfg;
|
||||
use rustc_interface::util::{self, collect_crate_types, get_codegen_backend};
|
||||
use rustc_interface::{interface, Queries};
|
||||
@ -207,7 +206,7 @@ impl Callbacks for TimePassesCallbacks {
|
||||
}
|
||||
|
||||
pub fn diagnostics_registry() -> Registry {
|
||||
Registry::new(rustc_error_codes::DIAGNOSTICS)
|
||||
Registry::new(rustc_errors::codes::DIAGNOSTICS)
|
||||
}
|
||||
|
||||
/// This is the primary entry point for rustc.
|
||||
@ -535,11 +534,12 @@ pub enum Compilation {
|
||||
}
|
||||
|
||||
fn handle_explain(early_dcx: &EarlyDiagCtxt, registry: Registry, code: &str, color: ColorConfig) {
|
||||
// Allow "E0123" or "0123" form.
|
||||
let upper_cased_code = code.to_ascii_uppercase();
|
||||
let normalised =
|
||||
if upper_cased_code.starts_with('E') { upper_cased_code } else { format!("E{code:0>4}") };
|
||||
match registry.try_find_description(&normalised) {
|
||||
Ok(description) => {
|
||||
let start = if upper_cased_code.starts_with('E') { 1 } else { 0 };
|
||||
if let Ok(code) = upper_cased_code[start..].parse::<u32>()
|
||||
&& let Ok(description) = registry.try_find_description(ErrCode::from_u32(code))
|
||||
{
|
||||
let mut is_in_code_block = false;
|
||||
let mut text = String::new();
|
||||
// Slice off the leading newline and print.
|
||||
@ -562,12 +562,10 @@ fn handle_explain(early_dcx: &EarlyDiagCtxt, registry: Registry, code: &str, col
|
||||
} else {
|
||||
safe_print!("{text}");
|
||||
}
|
||||
}
|
||||
Err(InvalidErrorCode) => {
|
||||
} else {
|
||||
early_dcx.early_fatal(format!("{code} is not a valid error code"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If color is always or auto, print formatted & colorized markdown. If color is never or
|
||||
/// if formatted printing fails, print the raw text.
|
||||
|
@ -1,658 +0,0 @@
|
||||
// Error messages for EXXXX errors. Each message should start and end with a
|
||||
// new line, and be wrapped to 80 characters. In vim you can `:set tw=80` and
|
||||
// use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
|
||||
//
|
||||
// /!\ IMPORTANT /!\
|
||||
//
|
||||
// Error messages' format must follow the RFC 1567 available here:
|
||||
// https://rust-lang.github.io/rfcs/1567-long-error-codes-explanation-normalization.html
|
||||
|
||||
register_diagnostics! {
|
||||
E0001: include_str!("./error_codes/E0001.md"),
|
||||
E0002: include_str!("./error_codes/E0002.md"),
|
||||
E0004: include_str!("./error_codes/E0004.md"),
|
||||
E0005: include_str!("./error_codes/E0005.md"),
|
||||
E0007: include_str!("./error_codes/E0007.md"),
|
||||
E0009: include_str!("./error_codes/E0009.md"),
|
||||
E0010: include_str!("./error_codes/E0010.md"),
|
||||
E0013: include_str!("./error_codes/E0013.md"),
|
||||
E0014: include_str!("./error_codes/E0014.md"),
|
||||
E0015: include_str!("./error_codes/E0015.md"),
|
||||
E0023: include_str!("./error_codes/E0023.md"),
|
||||
E0025: include_str!("./error_codes/E0025.md"),
|
||||
E0026: include_str!("./error_codes/E0026.md"),
|
||||
E0027: include_str!("./error_codes/E0027.md"),
|
||||
E0029: include_str!("./error_codes/E0029.md"),
|
||||
E0030: include_str!("./error_codes/E0030.md"),
|
||||
E0033: include_str!("./error_codes/E0033.md"),
|
||||
E0034: include_str!("./error_codes/E0034.md"),
|
||||
E0038: include_str!("./error_codes/E0038.md"),
|
||||
E0040: include_str!("./error_codes/E0040.md"),
|
||||
E0044: include_str!("./error_codes/E0044.md"),
|
||||
E0045: include_str!("./error_codes/E0045.md"),
|
||||
E0046: include_str!("./error_codes/E0046.md"),
|
||||
E0049: include_str!("./error_codes/E0049.md"),
|
||||
E0050: include_str!("./error_codes/E0050.md"),
|
||||
E0053: include_str!("./error_codes/E0053.md"),
|
||||
E0054: include_str!("./error_codes/E0054.md"),
|
||||
E0055: include_str!("./error_codes/E0055.md"),
|
||||
E0057: include_str!("./error_codes/E0057.md"),
|
||||
E0059: include_str!("./error_codes/E0059.md"),
|
||||
E0060: include_str!("./error_codes/E0060.md"),
|
||||
E0061: include_str!("./error_codes/E0061.md"),
|
||||
E0062: include_str!("./error_codes/E0062.md"),
|
||||
E0063: include_str!("./error_codes/E0063.md"),
|
||||
E0067: include_str!("./error_codes/E0067.md"),
|
||||
E0069: include_str!("./error_codes/E0069.md"),
|
||||
E0070: include_str!("./error_codes/E0070.md"),
|
||||
E0071: include_str!("./error_codes/E0071.md"),
|
||||
E0072: include_str!("./error_codes/E0072.md"),
|
||||
E0073: include_str!("./error_codes/E0073.md"),
|
||||
E0074: include_str!("./error_codes/E0074.md"),
|
||||
E0075: include_str!("./error_codes/E0075.md"),
|
||||
E0076: include_str!("./error_codes/E0076.md"),
|
||||
E0077: include_str!("./error_codes/E0077.md"),
|
||||
E0080: include_str!("./error_codes/E0080.md"),
|
||||
E0081: include_str!("./error_codes/E0081.md"),
|
||||
E0084: include_str!("./error_codes/E0084.md"),
|
||||
E0087: include_str!("./error_codes/E0087.md"),
|
||||
E0088: include_str!("./error_codes/E0088.md"),
|
||||
E0089: include_str!("./error_codes/E0089.md"),
|
||||
E0090: include_str!("./error_codes/E0090.md"),
|
||||
E0091: include_str!("./error_codes/E0091.md"),
|
||||
E0092: include_str!("./error_codes/E0092.md"),
|
||||
E0093: include_str!("./error_codes/E0093.md"),
|
||||
E0094: include_str!("./error_codes/E0094.md"),
|
||||
E0106: include_str!("./error_codes/E0106.md"),
|
||||
E0107: include_str!("./error_codes/E0107.md"),
|
||||
E0109: include_str!("./error_codes/E0109.md"),
|
||||
E0110: include_str!("./error_codes/E0110.md"),
|
||||
E0116: include_str!("./error_codes/E0116.md"),
|
||||
E0117: include_str!("./error_codes/E0117.md"),
|
||||
E0118: include_str!("./error_codes/E0118.md"),
|
||||
E0119: include_str!("./error_codes/E0119.md"),
|
||||
E0120: include_str!("./error_codes/E0120.md"),
|
||||
E0121: include_str!("./error_codes/E0121.md"),
|
||||
E0124: include_str!("./error_codes/E0124.md"),
|
||||
E0128: include_str!("./error_codes/E0128.md"),
|
||||
E0130: include_str!("./error_codes/E0130.md"),
|
||||
E0131: include_str!("./error_codes/E0131.md"),
|
||||
E0132: include_str!("./error_codes/E0132.md"),
|
||||
E0133: include_str!("./error_codes/E0133.md"),
|
||||
E0136: include_str!("./error_codes/E0136.md"),
|
||||
E0137: include_str!("./error_codes/E0137.md"),
|
||||
E0138: include_str!("./error_codes/E0138.md"),
|
||||
E0139: include_str!("./error_codes/E0139.md"),
|
||||
E0152: include_str!("./error_codes/E0152.md"),
|
||||
E0154: include_str!("./error_codes/E0154.md"),
|
||||
E0158: include_str!("./error_codes/E0158.md"),
|
||||
E0161: include_str!("./error_codes/E0161.md"),
|
||||
E0162: include_str!("./error_codes/E0162.md"),
|
||||
E0164: include_str!("./error_codes/E0164.md"),
|
||||
E0165: include_str!("./error_codes/E0165.md"),
|
||||
E0170: include_str!("./error_codes/E0170.md"),
|
||||
E0178: include_str!("./error_codes/E0178.md"),
|
||||
E0183: include_str!("./error_codes/E0183.md"),
|
||||
E0184: include_str!("./error_codes/E0184.md"),
|
||||
E0185: include_str!("./error_codes/E0185.md"),
|
||||
E0186: include_str!("./error_codes/E0186.md"),
|
||||
E0191: include_str!("./error_codes/E0191.md"),
|
||||
E0192: include_str!("./error_codes/E0192.md"),
|
||||
E0193: include_str!("./error_codes/E0193.md"),
|
||||
E0195: include_str!("./error_codes/E0195.md"),
|
||||
E0197: include_str!("./error_codes/E0197.md"),
|
||||
E0198: include_str!("./error_codes/E0198.md"),
|
||||
E0199: include_str!("./error_codes/E0199.md"),
|
||||
E0200: include_str!("./error_codes/E0200.md"),
|
||||
E0201: include_str!("./error_codes/E0201.md"),
|
||||
E0203: include_str!("./error_codes/E0203.md"),
|
||||
E0204: include_str!("./error_codes/E0204.md"),
|
||||
E0205: include_str!("./error_codes/E0205.md"),
|
||||
E0206: include_str!("./error_codes/E0206.md"),
|
||||
E0207: include_str!("./error_codes/E0207.md"),
|
||||
E0208: include_str!("./error_codes/E0208.md"),
|
||||
E0210: include_str!("./error_codes/E0210.md"),
|
||||
E0211: include_str!("./error_codes/E0211.md"),
|
||||
E0212: include_str!("./error_codes/E0212.md"),
|
||||
E0214: include_str!("./error_codes/E0214.md"),
|
||||
E0220: include_str!("./error_codes/E0220.md"),
|
||||
E0221: include_str!("./error_codes/E0221.md"),
|
||||
E0222: include_str!("./error_codes/E0222.md"),
|
||||
E0223: include_str!("./error_codes/E0223.md"),
|
||||
E0224: include_str!("./error_codes/E0224.md"),
|
||||
E0225: include_str!("./error_codes/E0225.md"),
|
||||
E0226: include_str!("./error_codes/E0226.md"),
|
||||
E0227: include_str!("./error_codes/E0227.md"),
|
||||
E0228: include_str!("./error_codes/E0228.md"),
|
||||
E0229: include_str!("./error_codes/E0229.md"),
|
||||
E0230: include_str!("./error_codes/E0230.md"),
|
||||
E0231: include_str!("./error_codes/E0231.md"),
|
||||
E0232: include_str!("./error_codes/E0232.md"),
|
||||
E0243: include_str!("./error_codes/E0243.md"),
|
||||
E0244: include_str!("./error_codes/E0244.md"),
|
||||
E0251: include_str!("./error_codes/E0251.md"),
|
||||
E0252: include_str!("./error_codes/E0252.md"),
|
||||
E0253: include_str!("./error_codes/E0253.md"),
|
||||
E0254: include_str!("./error_codes/E0254.md"),
|
||||
E0255: include_str!("./error_codes/E0255.md"),
|
||||
E0256: include_str!("./error_codes/E0256.md"),
|
||||
E0259: include_str!("./error_codes/E0259.md"),
|
||||
E0260: include_str!("./error_codes/E0260.md"),
|
||||
E0261: include_str!("./error_codes/E0261.md"),
|
||||
E0262: include_str!("./error_codes/E0262.md"),
|
||||
E0263: include_str!("./error_codes/E0263.md"),
|
||||
E0264: include_str!("./error_codes/E0264.md"),
|
||||
E0267: include_str!("./error_codes/E0267.md"),
|
||||
E0268: include_str!("./error_codes/E0268.md"),
|
||||
E0271: include_str!("./error_codes/E0271.md"),
|
||||
E0275: include_str!("./error_codes/E0275.md"),
|
||||
E0276: include_str!("./error_codes/E0276.md"),
|
||||
E0277: include_str!("./error_codes/E0277.md"),
|
||||
E0281: include_str!("./error_codes/E0281.md"),
|
||||
E0282: include_str!("./error_codes/E0282.md"),
|
||||
E0283: include_str!("./error_codes/E0283.md"),
|
||||
E0284: include_str!("./error_codes/E0284.md"),
|
||||
E0297: include_str!("./error_codes/E0297.md"),
|
||||
E0301: include_str!("./error_codes/E0301.md"),
|
||||
E0302: include_str!("./error_codes/E0302.md"),
|
||||
E0303: include_str!("./error_codes/E0303.md"),
|
||||
E0307: include_str!("./error_codes/E0307.md"),
|
||||
E0308: include_str!("./error_codes/E0308.md"),
|
||||
E0309: include_str!("./error_codes/E0309.md"),
|
||||
E0310: include_str!("./error_codes/E0310.md"),
|
||||
E0311: include_str!("./error_codes/E0311.md"),
|
||||
E0312: include_str!("./error_codes/E0312.md"),
|
||||
E0316: include_str!("./error_codes/E0316.md"),
|
||||
E0317: include_str!("./error_codes/E0317.md"),
|
||||
E0320: include_str!("./error_codes/E0320.md"),
|
||||
E0321: include_str!("./error_codes/E0321.md"),
|
||||
E0322: include_str!("./error_codes/E0322.md"),
|
||||
E0323: include_str!("./error_codes/E0323.md"),
|
||||
E0324: include_str!("./error_codes/E0324.md"),
|
||||
E0325: include_str!("./error_codes/E0325.md"),
|
||||
E0326: include_str!("./error_codes/E0326.md"),
|
||||
E0328: include_str!("./error_codes/E0328.md"),
|
||||
E0329: include_str!("./error_codes/E0329.md"),
|
||||
E0364: include_str!("./error_codes/E0364.md"),
|
||||
E0365: include_str!("./error_codes/E0365.md"),
|
||||
E0366: include_str!("./error_codes/E0366.md"),
|
||||
E0367: include_str!("./error_codes/E0367.md"),
|
||||
E0368: include_str!("./error_codes/E0368.md"),
|
||||
E0369: include_str!("./error_codes/E0369.md"),
|
||||
E0370: include_str!("./error_codes/E0370.md"),
|
||||
E0371: include_str!("./error_codes/E0371.md"),
|
||||
E0373: include_str!("./error_codes/E0373.md"),
|
||||
E0374: include_str!("./error_codes/E0374.md"),
|
||||
E0375: include_str!("./error_codes/E0375.md"),
|
||||
E0376: include_str!("./error_codes/E0376.md"),
|
||||
E0377: include_str!("./error_codes/E0377.md"),
|
||||
E0378: include_str!("./error_codes/E0378.md"),
|
||||
E0379: include_str!("./error_codes/E0379.md"),
|
||||
E0380: include_str!("./error_codes/E0380.md"),
|
||||
E0381: include_str!("./error_codes/E0381.md"),
|
||||
E0382: include_str!("./error_codes/E0382.md"),
|
||||
E0383: include_str!("./error_codes/E0383.md"),
|
||||
E0384: include_str!("./error_codes/E0384.md"),
|
||||
E0386: include_str!("./error_codes/E0386.md"),
|
||||
E0387: include_str!("./error_codes/E0387.md"),
|
||||
E0388: include_str!("./error_codes/E0388.md"),
|
||||
E0389: include_str!("./error_codes/E0389.md"),
|
||||
E0390: include_str!("./error_codes/E0390.md"),
|
||||
E0391: include_str!("./error_codes/E0391.md"),
|
||||
E0392: include_str!("./error_codes/E0392.md"),
|
||||
E0393: include_str!("./error_codes/E0393.md"),
|
||||
E0398: include_str!("./error_codes/E0398.md"),
|
||||
E0399: include_str!("./error_codes/E0399.md"),
|
||||
E0401: include_str!("./error_codes/E0401.md"),
|
||||
E0403: include_str!("./error_codes/E0403.md"),
|
||||
E0404: include_str!("./error_codes/E0404.md"),
|
||||
E0405: include_str!("./error_codes/E0405.md"),
|
||||
E0407: include_str!("./error_codes/E0407.md"),
|
||||
E0408: include_str!("./error_codes/E0408.md"),
|
||||
E0409: include_str!("./error_codes/E0409.md"),
|
||||
E0411: include_str!("./error_codes/E0411.md"),
|
||||
E0412: include_str!("./error_codes/E0412.md"),
|
||||
E0415: include_str!("./error_codes/E0415.md"),
|
||||
E0416: include_str!("./error_codes/E0416.md"),
|
||||
E0422: include_str!("./error_codes/E0422.md"),
|
||||
E0423: include_str!("./error_codes/E0423.md"),
|
||||
E0424: include_str!("./error_codes/E0424.md"),
|
||||
E0425: include_str!("./error_codes/E0425.md"),
|
||||
E0426: include_str!("./error_codes/E0426.md"),
|
||||
E0428: include_str!("./error_codes/E0428.md"),
|
||||
E0429: include_str!("./error_codes/E0429.md"),
|
||||
E0430: include_str!("./error_codes/E0430.md"),
|
||||
E0431: include_str!("./error_codes/E0431.md"),
|
||||
E0432: include_str!("./error_codes/E0432.md"),
|
||||
E0433: include_str!("./error_codes/E0433.md"),
|
||||
E0434: include_str!("./error_codes/E0434.md"),
|
||||
E0435: include_str!("./error_codes/E0435.md"),
|
||||
E0436: include_str!("./error_codes/E0436.md"),
|
||||
E0437: include_str!("./error_codes/E0437.md"),
|
||||
E0438: include_str!("./error_codes/E0438.md"),
|
||||
E0439: include_str!("./error_codes/E0439.md"),
|
||||
E0445: include_str!("./error_codes/E0445.md"),
|
||||
E0446: include_str!("./error_codes/E0446.md"),
|
||||
E0447: include_str!("./error_codes/E0447.md"),
|
||||
E0448: include_str!("./error_codes/E0448.md"),
|
||||
E0449: include_str!("./error_codes/E0449.md"),
|
||||
E0451: include_str!("./error_codes/E0451.md"),
|
||||
E0452: include_str!("./error_codes/E0452.md"),
|
||||
E0453: include_str!("./error_codes/E0453.md"),
|
||||
E0454: include_str!("./error_codes/E0454.md"),
|
||||
E0455: include_str!("./error_codes/E0455.md"),
|
||||
E0457: include_str!("./error_codes/E0457.md"),
|
||||
E0458: include_str!("./error_codes/E0458.md"),
|
||||
E0459: include_str!("./error_codes/E0459.md"),
|
||||
E0460: include_str!("./error_codes/E0460.md"),
|
||||
E0461: include_str!("./error_codes/E0461.md"),
|
||||
E0462: include_str!("./error_codes/E0462.md"),
|
||||
E0463: include_str!("./error_codes/E0463.md"),
|
||||
E0464: include_str!("./error_codes/E0464.md"),
|
||||
E0466: include_str!("./error_codes/E0466.md"),
|
||||
E0468: include_str!("./error_codes/E0468.md"),
|
||||
E0469: include_str!("./error_codes/E0469.md"),
|
||||
E0472: include_str!("./error_codes/E0472.md"),
|
||||
E0476: include_str!("./error_codes/E0476.md"),
|
||||
E0477: include_str!("./error_codes/E0477.md"),
|
||||
E0478: include_str!("./error_codes/E0478.md"),
|
||||
E0482: include_str!("./error_codes/E0482.md"),
|
||||
E0491: include_str!("./error_codes/E0491.md"),
|
||||
E0492: include_str!("./error_codes/E0492.md"),
|
||||
E0493: include_str!("./error_codes/E0493.md"),
|
||||
E0495: include_str!("./error_codes/E0495.md"),
|
||||
E0496: include_str!("./error_codes/E0496.md"),
|
||||
E0497: include_str!("./error_codes/E0497.md"),
|
||||
E0498: include_str!("./error_codes/E0498.md"),
|
||||
E0499: include_str!("./error_codes/E0499.md"),
|
||||
E0500: include_str!("./error_codes/E0500.md"),
|
||||
E0501: include_str!("./error_codes/E0501.md"),
|
||||
E0502: include_str!("./error_codes/E0502.md"),
|
||||
E0503: include_str!("./error_codes/E0503.md"),
|
||||
E0504: include_str!("./error_codes/E0504.md"),
|
||||
E0505: include_str!("./error_codes/E0505.md"),
|
||||
E0506: include_str!("./error_codes/E0506.md"),
|
||||
E0507: include_str!("./error_codes/E0507.md"),
|
||||
E0508: include_str!("./error_codes/E0508.md"),
|
||||
E0509: include_str!("./error_codes/E0509.md"),
|
||||
E0510: include_str!("./error_codes/E0510.md"),
|
||||
E0511: include_str!("./error_codes/E0511.md"),
|
||||
E0512: include_str!("./error_codes/E0512.md"),
|
||||
E0514: include_str!("./error_codes/E0514.md"),
|
||||
E0515: include_str!("./error_codes/E0515.md"),
|
||||
E0516: include_str!("./error_codes/E0516.md"),
|
||||
E0517: include_str!("./error_codes/E0517.md"),
|
||||
E0518: include_str!("./error_codes/E0518.md"),
|
||||
E0519: include_str!("./error_codes/E0519.md"),
|
||||
E0520: include_str!("./error_codes/E0520.md"),
|
||||
E0521: include_str!("./error_codes/E0521.md"),
|
||||
E0522: include_str!("./error_codes/E0522.md"),
|
||||
E0523: include_str!("./error_codes/E0523.md"),
|
||||
E0524: include_str!("./error_codes/E0524.md"),
|
||||
E0525: include_str!("./error_codes/E0525.md"),
|
||||
E0527: include_str!("./error_codes/E0527.md"),
|
||||
E0528: include_str!("./error_codes/E0528.md"),
|
||||
E0529: include_str!("./error_codes/E0529.md"),
|
||||
E0530: include_str!("./error_codes/E0530.md"),
|
||||
E0531: include_str!("./error_codes/E0531.md"),
|
||||
E0532: include_str!("./error_codes/E0532.md"),
|
||||
E0533: include_str!("./error_codes/E0533.md"),
|
||||
E0534: include_str!("./error_codes/E0534.md"),
|
||||
E0535: include_str!("./error_codes/E0535.md"),
|
||||
E0536: include_str!("./error_codes/E0536.md"),
|
||||
E0537: include_str!("./error_codes/E0537.md"),
|
||||
E0538: include_str!("./error_codes/E0538.md"),
|
||||
E0539: include_str!("./error_codes/E0539.md"),
|
||||
E0541: include_str!("./error_codes/E0541.md"),
|
||||
E0542: include_str!("./error_codes/E0542.md"),
|
||||
E0543: include_str!("./error_codes/E0543.md"),
|
||||
E0544: include_str!("./error_codes/E0544.md"),
|
||||
E0545: include_str!("./error_codes/E0545.md"),
|
||||
E0546: include_str!("./error_codes/E0546.md"),
|
||||
E0547: include_str!("./error_codes/E0547.md"),
|
||||
E0549: include_str!("./error_codes/E0549.md"),
|
||||
E0550: include_str!("./error_codes/E0550.md"),
|
||||
E0551: include_str!("./error_codes/E0551.md"),
|
||||
E0552: include_str!("./error_codes/E0552.md"),
|
||||
E0554: include_str!("./error_codes/E0554.md"),
|
||||
E0556: include_str!("./error_codes/E0556.md"),
|
||||
E0557: include_str!("./error_codes/E0557.md"),
|
||||
E0559: include_str!("./error_codes/E0559.md"),
|
||||
E0560: include_str!("./error_codes/E0560.md"),
|
||||
E0561: include_str!("./error_codes/E0561.md"),
|
||||
E0562: include_str!("./error_codes/E0562.md"),
|
||||
E0565: include_str!("./error_codes/E0565.md"),
|
||||
E0566: include_str!("./error_codes/E0566.md"),
|
||||
E0567: include_str!("./error_codes/E0567.md"),
|
||||
E0568: include_str!("./error_codes/E0568.md"),
|
||||
E0569: include_str!("./error_codes/E0569.md"),
|
||||
E0570: include_str!("./error_codes/E0570.md"),
|
||||
E0571: include_str!("./error_codes/E0571.md"),
|
||||
E0572: include_str!("./error_codes/E0572.md"),
|
||||
E0573: include_str!("./error_codes/E0573.md"),
|
||||
E0574: include_str!("./error_codes/E0574.md"),
|
||||
E0575: include_str!("./error_codes/E0575.md"),
|
||||
E0576: include_str!("./error_codes/E0576.md"),
|
||||
E0577: include_str!("./error_codes/E0577.md"),
|
||||
E0578: include_str!("./error_codes/E0578.md"),
|
||||
E0579: include_str!("./error_codes/E0579.md"),
|
||||
E0580: include_str!("./error_codes/E0580.md"),
|
||||
E0581: include_str!("./error_codes/E0581.md"),
|
||||
E0582: include_str!("./error_codes/E0582.md"),
|
||||
E0583: include_str!("./error_codes/E0583.md"),
|
||||
E0584: include_str!("./error_codes/E0584.md"),
|
||||
E0585: include_str!("./error_codes/E0585.md"),
|
||||
E0586: include_str!("./error_codes/E0586.md"),
|
||||
E0587: include_str!("./error_codes/E0587.md"),
|
||||
E0588: include_str!("./error_codes/E0588.md"),
|
||||
E0589: include_str!("./error_codes/E0589.md"),
|
||||
E0590: include_str!("./error_codes/E0590.md"),
|
||||
E0591: include_str!("./error_codes/E0591.md"),
|
||||
E0592: include_str!("./error_codes/E0592.md"),
|
||||
E0593: include_str!("./error_codes/E0593.md"),
|
||||
E0594: include_str!("./error_codes/E0594.md"),
|
||||
E0595: include_str!("./error_codes/E0595.md"),
|
||||
E0596: include_str!("./error_codes/E0596.md"),
|
||||
E0597: include_str!("./error_codes/E0597.md"),
|
||||
E0599: include_str!("./error_codes/E0599.md"),
|
||||
E0600: include_str!("./error_codes/E0600.md"),
|
||||
E0601: include_str!("./error_codes/E0601.md"),
|
||||
E0602: include_str!("./error_codes/E0602.md"),
|
||||
E0603: include_str!("./error_codes/E0603.md"),
|
||||
E0604: include_str!("./error_codes/E0604.md"),
|
||||
E0605: include_str!("./error_codes/E0605.md"),
|
||||
E0606: include_str!("./error_codes/E0606.md"),
|
||||
E0607: include_str!("./error_codes/E0607.md"),
|
||||
E0608: include_str!("./error_codes/E0608.md"),
|
||||
E0609: include_str!("./error_codes/E0609.md"),
|
||||
E0610: include_str!("./error_codes/E0610.md"),
|
||||
E0614: include_str!("./error_codes/E0614.md"),
|
||||
E0615: include_str!("./error_codes/E0615.md"),
|
||||
E0616: include_str!("./error_codes/E0616.md"),
|
||||
E0617: include_str!("./error_codes/E0617.md"),
|
||||
E0618: include_str!("./error_codes/E0618.md"),
|
||||
E0619: include_str!("./error_codes/E0619.md"),
|
||||
E0620: include_str!("./error_codes/E0620.md"),
|
||||
E0621: include_str!("./error_codes/E0621.md"),
|
||||
E0622: include_str!("./error_codes/E0622.md"),
|
||||
E0623: include_str!("./error_codes/E0623.md"),
|
||||
E0624: include_str!("./error_codes/E0624.md"),
|
||||
E0625: include_str!("./error_codes/E0625.md"),
|
||||
E0626: include_str!("./error_codes/E0626.md"),
|
||||
E0627: include_str!("./error_codes/E0627.md"),
|
||||
E0628: include_str!("./error_codes/E0628.md"),
|
||||
E0631: include_str!("./error_codes/E0631.md"),
|
||||
E0632: include_str!("./error_codes/E0632.md"),
|
||||
E0633: include_str!("./error_codes/E0633.md"),
|
||||
E0634: include_str!("./error_codes/E0634.md"),
|
||||
E0635: include_str!("./error_codes/E0635.md"),
|
||||
E0636: include_str!("./error_codes/E0636.md"),
|
||||
E0637: include_str!("./error_codes/E0637.md"),
|
||||
E0638: include_str!("./error_codes/E0638.md"),
|
||||
E0639: include_str!("./error_codes/E0639.md"),
|
||||
E0640: include_str!("./error_codes/E0640.md"),
|
||||
E0641: include_str!("./error_codes/E0641.md"),
|
||||
E0642: include_str!("./error_codes/E0642.md"),
|
||||
E0643: include_str!("./error_codes/E0643.md"),
|
||||
E0644: include_str!("./error_codes/E0644.md"),
|
||||
E0646: include_str!("./error_codes/E0646.md"),
|
||||
E0647: include_str!("./error_codes/E0647.md"),
|
||||
E0648: include_str!("./error_codes/E0648.md"),
|
||||
E0657: include_str!("./error_codes/E0657.md"),
|
||||
E0658: include_str!("./error_codes/E0658.md"),
|
||||
E0659: include_str!("./error_codes/E0659.md"),
|
||||
E0660: include_str!("./error_codes/E0660.md"),
|
||||
E0661: include_str!("./error_codes/E0661.md"),
|
||||
E0662: include_str!("./error_codes/E0662.md"),
|
||||
E0663: include_str!("./error_codes/E0663.md"),
|
||||
E0664: include_str!("./error_codes/E0664.md"),
|
||||
E0665: include_str!("./error_codes/E0665.md"),
|
||||
E0666: include_str!("./error_codes/E0666.md"),
|
||||
E0667: include_str!("./error_codes/E0667.md"),
|
||||
E0668: include_str!("./error_codes/E0668.md"),
|
||||
E0669: include_str!("./error_codes/E0669.md"),
|
||||
E0670: include_str!("./error_codes/E0670.md"),
|
||||
E0671: include_str!("./error_codes/E0671.md"),
|
||||
E0687: include_str!("./error_codes/E0687.md"),
|
||||
E0688: include_str!("./error_codes/E0688.md"),
|
||||
E0689: include_str!("./error_codes/E0689.md"),
|
||||
E0690: include_str!("./error_codes/E0690.md"),
|
||||
E0691: include_str!("./error_codes/E0691.md"),
|
||||
E0692: include_str!("./error_codes/E0692.md"),
|
||||
E0693: include_str!("./error_codes/E0693.md"),
|
||||
E0695: include_str!("./error_codes/E0695.md"),
|
||||
E0696: include_str!("./error_codes/E0696.md"),
|
||||
E0697: include_str!("./error_codes/E0697.md"),
|
||||
E0698: include_str!("./error_codes/E0698.md"),
|
||||
E0699: include_str!("./error_codes/E0699.md"),
|
||||
E0700: include_str!("./error_codes/E0700.md"),
|
||||
E0701: include_str!("./error_codes/E0701.md"),
|
||||
E0703: include_str!("./error_codes/E0703.md"),
|
||||
E0704: include_str!("./error_codes/E0704.md"),
|
||||
E0705: include_str!("./error_codes/E0705.md"),
|
||||
E0706: include_str!("./error_codes/E0706.md"),
|
||||
E0708: include_str!("./error_codes/E0708.md"),
|
||||
E0710: include_str!("./error_codes/E0710.md"),
|
||||
E0712: include_str!("./error_codes/E0712.md"),
|
||||
E0713: include_str!("./error_codes/E0713.md"),
|
||||
E0714: include_str!("./error_codes/E0714.md"),
|
||||
E0715: include_str!("./error_codes/E0715.md"),
|
||||
E0716: include_str!("./error_codes/E0716.md"),
|
||||
E0711: include_str!("./error_codes/E0711.md"),
|
||||
E0717: include_str!("./error_codes/E0717.md"),
|
||||
E0718: include_str!("./error_codes/E0718.md"),
|
||||
E0719: include_str!("./error_codes/E0719.md"),
|
||||
E0720: include_str!("./error_codes/E0720.md"),
|
||||
E0722: include_str!("./error_codes/E0722.md"),
|
||||
E0724: include_str!("./error_codes/E0724.md"),
|
||||
E0725: include_str!("./error_codes/E0725.md"),
|
||||
E0726: include_str!("./error_codes/E0726.md"),
|
||||
E0727: include_str!("./error_codes/E0727.md"),
|
||||
E0728: include_str!("./error_codes/E0728.md"),
|
||||
E0729: include_str!("./error_codes/E0729.md"),
|
||||
E0730: include_str!("./error_codes/E0730.md"),
|
||||
E0731: include_str!("./error_codes/E0731.md"),
|
||||
E0732: include_str!("./error_codes/E0732.md"),
|
||||
E0733: include_str!("./error_codes/E0733.md"),
|
||||
E0734: include_str!("./error_codes/E0734.md"),
|
||||
E0735: include_str!("./error_codes/E0735.md"),
|
||||
E0736: include_str!("./error_codes/E0736.md"),
|
||||
E0737: include_str!("./error_codes/E0737.md"),
|
||||
E0739: include_str!("./error_codes/E0739.md"),
|
||||
E0740: include_str!("./error_codes/E0740.md"),
|
||||
E0741: include_str!("./error_codes/E0741.md"),
|
||||
E0742: include_str!("./error_codes/E0742.md"),
|
||||
E0743: include_str!("./error_codes/E0743.md"),
|
||||
E0744: include_str!("./error_codes/E0744.md"),
|
||||
E0745: include_str!("./error_codes/E0745.md"),
|
||||
E0746: include_str!("./error_codes/E0746.md"),
|
||||
E0747: include_str!("./error_codes/E0747.md"),
|
||||
E0748: include_str!("./error_codes/E0748.md"),
|
||||
E0749: include_str!("./error_codes/E0749.md"),
|
||||
E0750: include_str!("./error_codes/E0750.md"),
|
||||
E0751: include_str!("./error_codes/E0751.md"),
|
||||
E0752: include_str!("./error_codes/E0752.md"),
|
||||
E0753: include_str!("./error_codes/E0753.md"),
|
||||
E0754: include_str!("./error_codes/E0754.md"),
|
||||
E0755: include_str!("./error_codes/E0755.md"),
|
||||
E0756: include_str!("./error_codes/E0756.md"),
|
||||
E0757: include_str!("./error_codes/E0757.md"),
|
||||
E0758: include_str!("./error_codes/E0758.md"),
|
||||
E0759: include_str!("./error_codes/E0759.md"),
|
||||
E0760: include_str!("./error_codes/E0760.md"),
|
||||
E0761: include_str!("./error_codes/E0761.md"),
|
||||
E0762: include_str!("./error_codes/E0762.md"),
|
||||
E0763: include_str!("./error_codes/E0763.md"),
|
||||
E0764: include_str!("./error_codes/E0764.md"),
|
||||
E0765: include_str!("./error_codes/E0765.md"),
|
||||
E0766: include_str!("./error_codes/E0766.md"),
|
||||
E0767: include_str!("./error_codes/E0767.md"),
|
||||
E0768: include_str!("./error_codes/E0768.md"),
|
||||
E0769: include_str!("./error_codes/E0769.md"),
|
||||
E0770: include_str!("./error_codes/E0770.md"),
|
||||
E0771: include_str!("./error_codes/E0771.md"),
|
||||
E0772: include_str!("./error_codes/E0772.md"),
|
||||
E0773: include_str!("./error_codes/E0773.md"),
|
||||
E0774: include_str!("./error_codes/E0774.md"),
|
||||
E0775: include_str!("./error_codes/E0775.md"),
|
||||
E0776: include_str!("./error_codes/E0776.md"),
|
||||
E0777: include_str!("./error_codes/E0777.md"),
|
||||
E0778: include_str!("./error_codes/E0778.md"),
|
||||
E0779: include_str!("./error_codes/E0779.md"),
|
||||
E0780: include_str!("./error_codes/E0780.md"),
|
||||
E0781: include_str!("./error_codes/E0781.md"),
|
||||
E0782: include_str!("./error_codes/E0782.md"),
|
||||
E0783: include_str!("./error_codes/E0783.md"),
|
||||
E0784: include_str!("./error_codes/E0784.md"),
|
||||
E0785: include_str!("./error_codes/E0785.md"),
|
||||
E0786: include_str!("./error_codes/E0786.md"),
|
||||
E0787: include_str!("./error_codes/E0787.md"),
|
||||
E0788: include_str!("./error_codes/E0788.md"),
|
||||
E0789: include_str!("./error_codes/E0789.md"),
|
||||
E0790: include_str!("./error_codes/E0790.md"),
|
||||
E0791: include_str!("./error_codes/E0791.md"),
|
||||
E0792: include_str!("./error_codes/E0792.md"),
|
||||
E0793: include_str!("./error_codes/E0793.md"),
|
||||
E0794: include_str!("./error_codes/E0794.md"),
|
||||
E0795: include_str!("./error_codes/E0795.md"),
|
||||
E0796: include_str!("./error_codes/E0796.md"),
|
||||
E0797: include_str!("./error_codes/E0797.md"),
|
||||
}
|
||||
|
||||
// Undocumented removed error codes. Note that many removed error codes are kept in the list above
|
||||
// and marked as no-longer emitted with a note in the markdown file (see E0001 for an example).
|
||||
// E0006, // merged with E0005
|
||||
// E0008, // cannot bind by-move into a pattern guard
|
||||
// E0019, // merged into E0015
|
||||
// E0035, // merged into E0087/E0089
|
||||
// E0036, // merged into E0087/E0089
|
||||
// E0068,
|
||||
// E0085,
|
||||
// E0086,
|
||||
// E0101, // replaced with E0282
|
||||
// E0102, // replaced with E0282
|
||||
// E0103,
|
||||
// E0104,
|
||||
// E0122, // bounds in type aliases are ignored, turned into proper lint
|
||||
// E0123,
|
||||
// E0127,
|
||||
// E0129,
|
||||
// E0134,
|
||||
// E0135,
|
||||
// E0141,
|
||||
// E0153, // unused error code
|
||||
// E0157, // unused error code
|
||||
// E0159, // use of trait `{}` as struct constructor
|
||||
// E0163, // merged into E0071
|
||||
// E0167,
|
||||
// E0168,
|
||||
// E0172, // non-trait found in a type sum, moved to resolve
|
||||
// E0173, // manual implementations of unboxed closure traits are experimental
|
||||
// E0174,
|
||||
// E0182, // merged into E0229
|
||||
// E0187, // cannot infer the kind of the closure
|
||||
// E0188, // can not cast an immutable reference to a mutable pointer
|
||||
// E0189, // deprecated: can only cast a boxed pointer to a boxed object
|
||||
// E0190, // deprecated: can only cast a &-pointer to an &-object
|
||||
// E0194, // merged into E0403
|
||||
// E0196, // cannot determine a type for this closure
|
||||
// E0209, // builtin traits can only be implemented on structs or enums
|
||||
// E0213, // associated types are not accepted in this context
|
||||
// E0215, // angle-bracket notation is not stable with `Fn`
|
||||
// E0216, // parenthetical notation is only stable with `Fn`
|
||||
// E0217, // ambiguous associated type, defined in multiple supertraits
|
||||
// E0218, // no associated type defined
|
||||
// E0219, // associated type defined in higher-ranked supertrait
|
||||
// E0233,
|
||||
// E0234,
|
||||
// E0235, // structure constructor specifies a structure of type but
|
||||
// E0236, // no lang item for range syntax
|
||||
// E0237, // no lang item for range syntax
|
||||
// E0238, // parenthesized parameters may only be used with a trait
|
||||
// E0239, // `next` method of `Iterator` trait has unexpected type
|
||||
// E0240,
|
||||
// E0241,
|
||||
// E0242,
|
||||
// E0245, // not a trait
|
||||
// E0246, // invalid recursive type
|
||||
// E0247,
|
||||
// E0248, // value used as a type, now reported earlier during resolution
|
||||
// // as E0412
|
||||
// E0249,
|
||||
// E0257,
|
||||
// E0258,
|
||||
// E0272, // on_unimplemented #0
|
||||
// E0273, // on_unimplemented #1
|
||||
// E0274, // on_unimplemented #2
|
||||
// E0278, // requirement is not satisfied
|
||||
// E0279,
|
||||
// E0280, // changed to ICE
|
||||
// E0285, // overflow evaluation builtin bounds
|
||||
// E0296, // replaced with a generic attribute input check
|
||||
// E0298, // cannot compare constants
|
||||
// E0299, // mismatched types between arms
|
||||
// E0300, // unexpanded macro
|
||||
// E0304, // expected signed integer constant
|
||||
// E0305, // expected constant
|
||||
// E0313, // removed: found unreachable
|
||||
// E0314, // closure outlives stack frame
|
||||
// E0315, // cannot invoke closure outside of its lifetime
|
||||
// E0319, // trait impls for defaulted traits allowed just for structs/enums
|
||||
// E0372, // coherence not object safe
|
||||
// E0385, // {} in an aliasable location
|
||||
// E0402, // cannot use an outer type parameter in this context
|
||||
// E0406, // merged into 420
|
||||
// E0410, // merged into 408
|
||||
// E0413, // merged into 530
|
||||
// E0414, // merged into 530
|
||||
// E0417, // merged into 532
|
||||
// E0418, // merged into 532
|
||||
// E0419, // merged into 531
|
||||
// E0420, // merged into 532
|
||||
// E0421, // merged into 531
|
||||
// E0427, // merged into 530
|
||||
// E0445, // merged into 446 and type privacy lints
|
||||
// E0456, // plugin `..` is not available for triple `..`
|
||||
// E0465, // removed: merged with E0464
|
||||
// E0467, // removed
|
||||
// E0470, // removed
|
||||
// E0471, // constant evaluation error (in pattern)
|
||||
// E0473, // dereference of reference outside its lifetime
|
||||
// E0474, // captured variable `..` does not outlive the enclosing closure
|
||||
// E0475, // index of slice outside its lifetime
|
||||
// E0479, // the type `..` (provided as the value of a type parameter) is...
|
||||
// E0480, // lifetime of method receiver does not outlive the method call
|
||||
// E0481, // lifetime of function argument does not outlive the function call
|
||||
// E0483, // lifetime of operand does not outlive the operation
|
||||
// E0484, // reference is not valid at the time of borrow
|
||||
// E0485, // automatically reference is not valid at the time of borrow
|
||||
// E0486, // type of expression contains references that are not valid during..
|
||||
// E0487, // unsafe use of destructor: destructor might be called while...
|
||||
// E0488, // lifetime of variable does not enclose its declaration
|
||||
// E0489, // type/lifetime parameter not in scope here
|
||||
// E0490, // removed: unreachable
|
||||
// E0526, // shuffle indices are not constant
|
||||
// E0540, // multiple rustc_deprecated attributes
|
||||
// E0548, // replaced with a generic attribute input check
|
||||
// E0553, // multiple rustc_const_unstable attributes
|
||||
// E0555, // replaced with a generic attribute input check
|
||||
// E0558, // replaced with a generic attribute input check
|
||||
// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
|
||||
// E0564, // only named lifetimes are allowed in `impl Trait`,
|
||||
// // but `{}` was found in the type `{}`
|
||||
// E0598, // lifetime of {} is too short to guarantee its contents can be...
|
||||
// E0611, // merged into E0616
|
||||
// E0612, // merged into E0609
|
||||
// E0613, // Removed (merged with E0609)
|
||||
// E0629, // missing 'feature' (rustc_const_unstable)
|
||||
// E0630, // rustc_const_unstable attribute must be paired with stable/unstable
|
||||
// // attribute
|
||||
// E0645, // trait aliases not finished
|
||||
// E0694, // an unknown tool name found in scoped attributes
|
||||
// E0702, // replaced with a generic attribute input check
|
||||
// E0707, // multiple elided lifetimes used in arguments of `async fn`
|
||||
// E0709, // multiple different lifetimes used in arguments of `async fn`
|
||||
// E0721, // `await` keyword
|
||||
// E0723, // unstable feature in `const` context
|
||||
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
|
||||
// E0744, // merged into E0728
|
@ -1,19 +1,679 @@
|
||||
//! This library is used to gather all error codes into one place, to make
|
||||
//! their maintenance easier.
|
||||
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![deny(rustdoc::invalid_codeblock_attributes)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
//! This library is used to gather all error codes into one place,
|
||||
//! the goal being to make their maintenance easier.
|
||||
|
||||
macro_rules! register_diagnostics {
|
||||
($($ecode:ident: $message:expr,)*) => (
|
||||
pub static DIAGNOSTICS: &[(&str, &str)] = &[
|
||||
$( (stringify!($ecode), $message), )*
|
||||
];
|
||||
// This higher-order macro defines the error codes that are in use. It is used
|
||||
// in the `rustc_errors` crate. Removed error codes are listed in the comment
|
||||
// below.
|
||||
//
|
||||
// /!\ IMPORTANT /!\
|
||||
//
|
||||
// Error code explanation are defined in `error_codes/EXXXX.md` files. They must follow the RFC
|
||||
// 1567 available here:
|
||||
// https://rust-lang.github.io/rfcs/1567-long-error-codes-explanation-normalization.html
|
||||
//
|
||||
// Also, the contents of this macro is checked by tidy (in `check_error_codes_docs`). If you change
|
||||
// the macro syntax you will need to change tidy as well.
|
||||
//
|
||||
// Both columns are necessary because it's not possible in Rust to create a new identifier such as
|
||||
// `E0123` from an integer literal such as `0123`, unfortunately.
|
||||
#[macro_export]
|
||||
macro_rules! error_codes {
|
||||
($macro:path) => (
|
||||
$macro!(
|
||||
E0001: 0001,
|
||||
E0002: 0002,
|
||||
E0004: 0004,
|
||||
E0005: 0005,
|
||||
E0007: 0007,
|
||||
E0009: 0009,
|
||||
E0010: 0010,
|
||||
E0013: 0013,
|
||||
E0014: 0014,
|
||||
E0015: 0015,
|
||||
E0023: 0023,
|
||||
E0025: 0025,
|
||||
E0026: 0026,
|
||||
E0027: 0027,
|
||||
E0029: 0029,
|
||||
E0030: 0030,
|
||||
E0033: 0033,
|
||||
E0034: 0034,
|
||||
E0038: 0038,
|
||||
E0040: 0040,
|
||||
E0044: 0044,
|
||||
E0045: 0045,
|
||||
E0046: 0046,
|
||||
E0049: 0049,
|
||||
E0050: 0050,
|
||||
E0053: 0053,
|
||||
E0054: 0054,
|
||||
E0055: 0055,
|
||||
E0057: 0057,
|
||||
E0059: 0059,
|
||||
E0060: 0060,
|
||||
E0061: 0061,
|
||||
E0062: 0062,
|
||||
E0063: 0063,
|
||||
E0067: 0067,
|
||||
E0069: 0069,
|
||||
E0070: 0070,
|
||||
E0071: 0071,
|
||||
E0072: 0072,
|
||||
E0073: 0073,
|
||||
E0074: 0074,
|
||||
E0075: 0075,
|
||||
E0076: 0076,
|
||||
E0077: 0077,
|
||||
E0080: 0080,
|
||||
E0081: 0081,
|
||||
E0084: 0084,
|
||||
E0087: 0087,
|
||||
E0088: 0088,
|
||||
E0089: 0089,
|
||||
E0090: 0090,
|
||||
E0091: 0091,
|
||||
E0092: 0092,
|
||||
E0093: 0093,
|
||||
E0094: 0094,
|
||||
E0106: 0106,
|
||||
E0107: 0107,
|
||||
E0109: 0109,
|
||||
E0110: 0110,
|
||||
E0116: 0116,
|
||||
E0117: 0117,
|
||||
E0118: 0118,
|
||||
E0119: 0119,
|
||||
E0120: 0120,
|
||||
E0121: 0121,
|
||||
E0124: 0124,
|
||||
E0128: 0128,
|
||||
E0130: 0130,
|
||||
E0131: 0131,
|
||||
E0132: 0132,
|
||||
E0133: 0133,
|
||||
E0136: 0136,
|
||||
E0137: 0137,
|
||||
E0138: 0138,
|
||||
E0139: 0139,
|
||||
E0152: 0152,
|
||||
E0154: 0154,
|
||||
E0158: 0158,
|
||||
E0161: 0161,
|
||||
E0162: 0162,
|
||||
E0164: 0164,
|
||||
E0165: 0165,
|
||||
E0170: 0170,
|
||||
E0178: 0178,
|
||||
E0183: 0183,
|
||||
E0184: 0184,
|
||||
E0185: 0185,
|
||||
E0186: 0186,
|
||||
E0191: 0191,
|
||||
E0192: 0192,
|
||||
E0193: 0193,
|
||||
E0195: 0195,
|
||||
E0197: 0197,
|
||||
E0198: 0198,
|
||||
E0199: 0199,
|
||||
E0200: 0200,
|
||||
E0201: 0201,
|
||||
E0203: 0203,
|
||||
E0204: 0204,
|
||||
E0205: 0205,
|
||||
E0206: 0206,
|
||||
E0207: 0207,
|
||||
E0208: 0208,
|
||||
E0210: 0210,
|
||||
E0211: 0211,
|
||||
E0212: 0212,
|
||||
E0214: 0214,
|
||||
E0220: 0220,
|
||||
E0221: 0221,
|
||||
E0222: 0222,
|
||||
E0223: 0223,
|
||||
E0224: 0224,
|
||||
E0225: 0225,
|
||||
E0226: 0226,
|
||||
E0227: 0227,
|
||||
E0228: 0228,
|
||||
E0229: 0229,
|
||||
E0230: 0230,
|
||||
E0231: 0231,
|
||||
E0232: 0232,
|
||||
E0243: 0243,
|
||||
E0244: 0244,
|
||||
E0251: 0251,
|
||||
E0252: 0252,
|
||||
E0253: 0253,
|
||||
E0254: 0254,
|
||||
E0255: 0255,
|
||||
E0256: 0256,
|
||||
E0259: 0259,
|
||||
E0260: 0260,
|
||||
E0261: 0261,
|
||||
E0262: 0262,
|
||||
E0263: 0263,
|
||||
E0264: 0264,
|
||||
E0267: 0267,
|
||||
E0268: 0268,
|
||||
E0271: 0271,
|
||||
E0275: 0275,
|
||||
E0276: 0276,
|
||||
E0277: 0277,
|
||||
E0281: 0281,
|
||||
E0282: 0282,
|
||||
E0283: 0283,
|
||||
E0284: 0284,
|
||||
E0297: 0297,
|
||||
E0301: 0301,
|
||||
E0302: 0302,
|
||||
E0303: 0303,
|
||||
E0307: 0307,
|
||||
E0308: 0308,
|
||||
E0309: 0309,
|
||||
E0310: 0310,
|
||||
E0311: 0311,
|
||||
E0312: 0312,
|
||||
E0316: 0316,
|
||||
E0317: 0317,
|
||||
E0320: 0320,
|
||||
E0321: 0321,
|
||||
E0322: 0322,
|
||||
E0323: 0323,
|
||||
E0324: 0324,
|
||||
E0325: 0325,
|
||||
E0326: 0326,
|
||||
E0328: 0328,
|
||||
E0329: 0329,
|
||||
E0364: 0364,
|
||||
E0365: 0365,
|
||||
E0366: 0366,
|
||||
E0367: 0367,
|
||||
E0368: 0368,
|
||||
E0369: 0369,
|
||||
E0370: 0370,
|
||||
E0371: 0371,
|
||||
E0373: 0373,
|
||||
E0374: 0374,
|
||||
E0375: 0375,
|
||||
E0376: 0376,
|
||||
E0377: 0377,
|
||||
E0378: 0378,
|
||||
E0379: 0379,
|
||||
E0380: 0380,
|
||||
E0381: 0381,
|
||||
E0382: 0382,
|
||||
E0383: 0383,
|
||||
E0384: 0384,
|
||||
E0386: 0386,
|
||||
E0387: 0387,
|
||||
E0388: 0388,
|
||||
E0389: 0389,
|
||||
E0390: 0390,
|
||||
E0391: 0391,
|
||||
E0392: 0392,
|
||||
E0393: 0393,
|
||||
E0398: 0398,
|
||||
E0399: 0399,
|
||||
E0401: 0401,
|
||||
E0403: 0403,
|
||||
E0404: 0404,
|
||||
E0405: 0405,
|
||||
E0407: 0407,
|
||||
E0408: 0408,
|
||||
E0409: 0409,
|
||||
E0411: 0411,
|
||||
E0412: 0412,
|
||||
E0415: 0415,
|
||||
E0416: 0416,
|
||||
E0422: 0422,
|
||||
E0423: 0423,
|
||||
E0424: 0424,
|
||||
E0425: 0425,
|
||||
E0426: 0426,
|
||||
E0428: 0428,
|
||||
E0429: 0429,
|
||||
E0430: 0430,
|
||||
E0431: 0431,
|
||||
E0432: 0432,
|
||||
E0433: 0433,
|
||||
E0434: 0434,
|
||||
E0435: 0435,
|
||||
E0436: 0436,
|
||||
E0437: 0437,
|
||||
E0438: 0438,
|
||||
E0439: 0439,
|
||||
E0445: 0445,
|
||||
E0446: 0446,
|
||||
E0447: 0447,
|
||||
E0448: 0448,
|
||||
E0449: 0449,
|
||||
E0451: 0451,
|
||||
E0452: 0452,
|
||||
E0453: 0453,
|
||||
E0454: 0454,
|
||||
E0455: 0455,
|
||||
E0457: 0457,
|
||||
E0458: 0458,
|
||||
E0459: 0459,
|
||||
E0460: 0460,
|
||||
E0461: 0461,
|
||||
E0462: 0462,
|
||||
E0463: 0463,
|
||||
E0464: 0464,
|
||||
E0466: 0466,
|
||||
E0468: 0468,
|
||||
E0469: 0469,
|
||||
E0472: 0472,
|
||||
E0476: 0476,
|
||||
E0477: 0477,
|
||||
E0478: 0478,
|
||||
E0482: 0482,
|
||||
E0491: 0491,
|
||||
E0492: 0492,
|
||||
E0493: 0493,
|
||||
E0495: 0495,
|
||||
E0496: 0496,
|
||||
E0497: 0497,
|
||||
E0498: 0498,
|
||||
E0499: 0499,
|
||||
E0500: 0500,
|
||||
E0501: 0501,
|
||||
E0502: 0502,
|
||||
E0503: 0503,
|
||||
E0504: 0504,
|
||||
E0505: 0505,
|
||||
E0506: 0506,
|
||||
E0507: 0507,
|
||||
E0508: 0508,
|
||||
E0509: 0509,
|
||||
E0510: 0510,
|
||||
E0511: 0511,
|
||||
E0512: 0512,
|
||||
E0514: 0514,
|
||||
E0515: 0515,
|
||||
E0516: 0516,
|
||||
E0517: 0517,
|
||||
E0518: 0518,
|
||||
E0519: 0519,
|
||||
E0520: 0520,
|
||||
E0521: 0521,
|
||||
E0522: 0522,
|
||||
E0523: 0523,
|
||||
E0524: 0524,
|
||||
E0525: 0525,
|
||||
E0527: 0527,
|
||||
E0528: 0528,
|
||||
E0529: 0529,
|
||||
E0530: 0530,
|
||||
E0531: 0531,
|
||||
E0532: 0532,
|
||||
E0533: 0533,
|
||||
E0534: 0534,
|
||||
E0535: 0535,
|
||||
E0536: 0536,
|
||||
E0537: 0537,
|
||||
E0538: 0538,
|
||||
E0539: 0539,
|
||||
E0541: 0541,
|
||||
E0542: 0542,
|
||||
E0543: 0543,
|
||||
E0544: 0544,
|
||||
E0545: 0545,
|
||||
E0546: 0546,
|
||||
E0547: 0547,
|
||||
E0549: 0549,
|
||||
E0550: 0550,
|
||||
E0551: 0551,
|
||||
E0552: 0552,
|
||||
E0554: 0554,
|
||||
E0556: 0556,
|
||||
E0557: 0557,
|
||||
E0559: 0559,
|
||||
E0560: 0560,
|
||||
E0561: 0561,
|
||||
E0562: 0562,
|
||||
E0565: 0565,
|
||||
E0566: 0566,
|
||||
E0567: 0567,
|
||||
E0568: 0568,
|
||||
E0569: 0569,
|
||||
E0570: 0570,
|
||||
E0571: 0571,
|
||||
E0572: 0572,
|
||||
E0573: 0573,
|
||||
E0574: 0574,
|
||||
E0575: 0575,
|
||||
E0576: 0576,
|
||||
E0577: 0577,
|
||||
E0578: 0578,
|
||||
E0579: 0579,
|
||||
E0580: 0580,
|
||||
E0581: 0581,
|
||||
E0582: 0582,
|
||||
E0583: 0583,
|
||||
E0584: 0584,
|
||||
E0585: 0585,
|
||||
E0586: 0586,
|
||||
E0587: 0587,
|
||||
E0588: 0588,
|
||||
E0589: 0589,
|
||||
E0590: 0590,
|
||||
E0591: 0591,
|
||||
E0592: 0592,
|
||||
E0593: 0593,
|
||||
E0594: 0594,
|
||||
E0595: 0595,
|
||||
E0596: 0596,
|
||||
E0597: 0597,
|
||||
E0599: 0599,
|
||||
E0600: 0600,
|
||||
E0601: 0601,
|
||||
E0602: 0602,
|
||||
E0603: 0603,
|
||||
E0604: 0604,
|
||||
E0605: 0605,
|
||||
E0606: 0606,
|
||||
E0607: 0607,
|
||||
E0608: 0608,
|
||||
E0609: 0609,
|
||||
E0610: 0610,
|
||||
E0614: 0614,
|
||||
E0615: 0615,
|
||||
E0616: 0616,
|
||||
E0617: 0617,
|
||||
E0618: 0618,
|
||||
E0619: 0619,
|
||||
E0620: 0620,
|
||||
E0621: 0621,
|
||||
E0622: 0622,
|
||||
E0623: 0623,
|
||||
E0624: 0624,
|
||||
E0625: 0625,
|
||||
E0626: 0626,
|
||||
E0627: 0627,
|
||||
E0628: 0628,
|
||||
E0631: 0631,
|
||||
E0632: 0632,
|
||||
E0633: 0633,
|
||||
E0634: 0634,
|
||||
E0635: 0635,
|
||||
E0636: 0636,
|
||||
E0637: 0637,
|
||||
E0638: 0638,
|
||||
E0639: 0639,
|
||||
E0640: 0640,
|
||||
E0641: 0641,
|
||||
E0642: 0642,
|
||||
E0643: 0643,
|
||||
E0644: 0644,
|
||||
E0646: 0646,
|
||||
E0647: 0647,
|
||||
E0648: 0648,
|
||||
E0657: 0657,
|
||||
E0658: 0658,
|
||||
E0659: 0659,
|
||||
E0660: 0660,
|
||||
E0661: 0661,
|
||||
E0662: 0662,
|
||||
E0663: 0663,
|
||||
E0664: 0664,
|
||||
E0665: 0665,
|
||||
E0666: 0666,
|
||||
E0667: 0667,
|
||||
E0668: 0668,
|
||||
E0669: 0669,
|
||||
E0670: 0670,
|
||||
E0671: 0671,
|
||||
E0687: 0687,
|
||||
E0688: 0688,
|
||||
E0689: 0689,
|
||||
E0690: 0690,
|
||||
E0691: 0691,
|
||||
E0692: 0692,
|
||||
E0693: 0693,
|
||||
E0695: 0695,
|
||||
E0696: 0696,
|
||||
E0697: 0697,
|
||||
E0698: 0698,
|
||||
E0699: 0699,
|
||||
E0700: 0700,
|
||||
E0701: 0701,
|
||||
E0703: 0703,
|
||||
E0704: 0704,
|
||||
E0705: 0705,
|
||||
E0706: 0706,
|
||||
E0708: 0708,
|
||||
E0710: 0710,
|
||||
E0712: 0712,
|
||||
E0713: 0713,
|
||||
E0714: 0714,
|
||||
E0715: 0715,
|
||||
E0716: 0716,
|
||||
E0711: 0711,
|
||||
E0717: 0717,
|
||||
E0718: 0718,
|
||||
E0719: 0719,
|
||||
E0720: 0720,
|
||||
E0722: 0722,
|
||||
E0724: 0724,
|
||||
E0725: 0725,
|
||||
E0726: 0726,
|
||||
E0727: 0727,
|
||||
E0728: 0728,
|
||||
E0729: 0729,
|
||||
E0730: 0730,
|
||||
E0731: 0731,
|
||||
E0732: 0732,
|
||||
E0733: 0733,
|
||||
E0734: 0734,
|
||||
E0735: 0735,
|
||||
E0736: 0736,
|
||||
E0737: 0737,
|
||||
E0739: 0739,
|
||||
E0740: 0740,
|
||||
E0741: 0741,
|
||||
E0742: 0742,
|
||||
E0743: 0743,
|
||||
E0744: 0744,
|
||||
E0745: 0745,
|
||||
E0746: 0746,
|
||||
E0747: 0747,
|
||||
E0748: 0748,
|
||||
E0749: 0749,
|
||||
E0750: 0750,
|
||||
E0751: 0751,
|
||||
E0752: 0752,
|
||||
E0753: 0753,
|
||||
E0754: 0754,
|
||||
E0755: 0755,
|
||||
E0756: 0756,
|
||||
E0757: 0757,
|
||||
E0758: 0758,
|
||||
E0759: 0759,
|
||||
E0760: 0760,
|
||||
E0761: 0761,
|
||||
E0762: 0762,
|
||||
E0763: 0763,
|
||||
E0764: 0764,
|
||||
E0765: 0765,
|
||||
E0766: 0766,
|
||||
E0767: 0767,
|
||||
E0768: 0768,
|
||||
E0769: 0769,
|
||||
E0770: 0770,
|
||||
E0771: 0771,
|
||||
E0772: 0772,
|
||||
E0773: 0773,
|
||||
E0774: 0774,
|
||||
E0775: 0775,
|
||||
E0776: 0776,
|
||||
E0777: 0777,
|
||||
E0778: 0778,
|
||||
E0779: 0779,
|
||||
E0780: 0780,
|
||||
E0781: 0781,
|
||||
E0782: 0782,
|
||||
E0783: 0783,
|
||||
E0784: 0784,
|
||||
E0785: 0785,
|
||||
E0786: 0786,
|
||||
E0787: 0787,
|
||||
E0788: 0788,
|
||||
E0789: 0789,
|
||||
E0790: 0790,
|
||||
E0791: 0791,
|
||||
E0792: 0792,
|
||||
E0793: 0793,
|
||||
E0794: 0794,
|
||||
E0795: 0795,
|
||||
E0796: 0796,
|
||||
E0797: 0797,
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
mod error_codes;
|
||||
pub use error_codes::DIAGNOSTICS;
|
||||
// Undocumented removed error codes. Note that many removed error codes are kept in the list above
|
||||
// and marked as no-longer emitted with a note in the markdown file (see E0001 for an example).
|
||||
// E0006, // merged with E0005
|
||||
// E0008, // cannot bind by-move into a pattern guard
|
||||
// E0019, // merged into E0015
|
||||
// E0035, // merged into E0087/E0089
|
||||
// E0036, // merged into E0087/E0089
|
||||
// E0068,
|
||||
// E0085,
|
||||
// E0086,
|
||||
// E0101, // replaced with E0282
|
||||
// E0102, // replaced with E0282
|
||||
// E0103,
|
||||
// E0104,
|
||||
// E0122, // bounds in type aliases are ignored, turned into proper lint
|
||||
// E0123,
|
||||
// E0127,
|
||||
// E0129,
|
||||
// E0134,
|
||||
// E0135,
|
||||
// E0141,
|
||||
// E0153, // unused error code
|
||||
// E0157, // unused error code
|
||||
// E0159, // use of trait `{}` as struct constructor
|
||||
// E0163, // merged into E0071
|
||||
// E0167,
|
||||
// E0168,
|
||||
// E0172, // non-trait found in a type sum, moved to resolve
|
||||
// E0173, // manual implementations of unboxed closure traits are experimental
|
||||
// E0174,
|
||||
// E0182, // merged into E0229
|
||||
// E0187, // cannot infer the kind of the closure
|
||||
// E0188, // can not cast an immutable reference to a mutable pointer
|
||||
// E0189, // deprecated: can only cast a boxed pointer to a boxed object
|
||||
// E0190, // deprecated: can only cast a &-pointer to an &-object
|
||||
// E0194, // merged into E0403
|
||||
// E0196, // cannot determine a type for this closure
|
||||
// E0209, // builtin traits can only be implemented on structs or enums
|
||||
// E0213, // associated types are not accepted in this context
|
||||
// E0215, // angle-bracket notation is not stable with `Fn`
|
||||
// E0216, // parenthetical notation is only stable with `Fn`
|
||||
// E0217, // ambiguous associated type, defined in multiple supertraits
|
||||
// E0218, // no associated type defined
|
||||
// E0219, // associated type defined in higher-ranked supertrait
|
||||
// E0233,
|
||||
// E0234,
|
||||
// E0235, // structure constructor specifies a structure of type but
|
||||
// E0236, // no lang item for range syntax
|
||||
// E0237, // no lang item for range syntax
|
||||
// E0238, // parenthesized parameters may only be used with a trait
|
||||
// E0239, // `next` method of `Iterator` trait has unexpected type
|
||||
// E0240,
|
||||
// E0241,
|
||||
// E0242,
|
||||
// E0245, // not a trait
|
||||
// E0246, // invalid recursive type
|
||||
// E0247,
|
||||
// E0248, // value used as a type, now reported earlier during resolution
|
||||
// // as E0412
|
||||
// E0249,
|
||||
// E0257,
|
||||
// E0258,
|
||||
// E0272, // on_unimplemented #0
|
||||
// E0273, // on_unimplemented #1
|
||||
// E0274, // on_unimplemented #2
|
||||
// E0278, // requirement is not satisfied
|
||||
// E0279,
|
||||
// E0280, // changed to ICE
|
||||
// E0285, // overflow evaluation builtin bounds
|
||||
// E0296, // replaced with a generic attribute input check
|
||||
// E0298, // cannot compare constants
|
||||
// E0299, // mismatched types between arms
|
||||
// E0300, // unexpanded macro
|
||||
// E0304, // expected signed integer constant
|
||||
// E0305, // expected constant
|
||||
// E0313, // removed: found unreachable
|
||||
// E0314, // closure outlives stack frame
|
||||
// E0315, // cannot invoke closure outside of its lifetime
|
||||
// E0319, // trait impls for defaulted traits allowed just for structs/enums
|
||||
// E0372, // coherence not object safe
|
||||
// E0385, // {} in an aliasable location
|
||||
// E0402, // cannot use an outer type parameter in this context
|
||||
// E0406, // merged into 420
|
||||
// E0410, // merged into 408
|
||||
// E0413, // merged into 530
|
||||
// E0414, // merged into 530
|
||||
// E0417, // merged into 532
|
||||
// E0418, // merged into 532
|
||||
// E0419, // merged into 531
|
||||
// E0420, // merged into 532
|
||||
// E0421, // merged into 531
|
||||
// E0427, // merged into 530
|
||||
// E0445, // merged into 446 and type privacy lints
|
||||
// E0456, // plugin `..` is not available for triple `..`
|
||||
// E0465, // removed: merged with E0464
|
||||
// E0467, // removed
|
||||
// E0470, // removed
|
||||
// E0471, // constant evaluation error (in pattern)
|
||||
// E0473, // dereference of reference outside its lifetime
|
||||
// E0474, // captured variable `..` does not outlive the enclosing closure
|
||||
// E0475, // index of slice outside its lifetime
|
||||
// E0479, // the type `..` (provided as the value of a type parameter) is...
|
||||
// E0480, // lifetime of method receiver does not outlive the method call
|
||||
// E0481, // lifetime of function argument does not outlive the function call
|
||||
// E0483, // lifetime of operand does not outlive the operation
|
||||
// E0484, // reference is not valid at the time of borrow
|
||||
// E0485, // automatically reference is not valid at the time of borrow
|
||||
// E0486, // type of expression contains references that are not valid during..
|
||||
// E0487, // unsafe use of destructor: destructor might be called while...
|
||||
// E0488, // lifetime of variable does not enclose its declaration
|
||||
// E0489, // type/lifetime parameter not in scope here
|
||||
// E0490, // removed: unreachable
|
||||
// E0526, // shuffle indices are not constant
|
||||
// E0540, // multiple rustc_deprecated attributes
|
||||
// E0548, // replaced with a generic attribute input check
|
||||
// E0553, // multiple rustc_const_unstable attributes
|
||||
// E0555, // replaced with a generic attribute input check
|
||||
// E0558, // replaced with a generic attribute input check
|
||||
// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
|
||||
// E0564, // only named lifetimes are allowed in `impl Trait`,
|
||||
// // but `{}` was found in the type `{}`
|
||||
// E0598, // lifetime of {} is too short to guarantee its contents can be...
|
||||
// E0611, // merged into E0616
|
||||
// E0612, // merged into E0609
|
||||
// E0613, // Removed (merged with E0609)
|
||||
// E0629, // missing 'feature' (rustc_const_unstable)
|
||||
// E0630, // rustc_const_unstable attribute must be paired with stable/unstable
|
||||
// // attribute
|
||||
// E0645, // trait aliases not finished
|
||||
// E0694, // an unknown tool name found in scoped attributes
|
||||
// E0702, // replaced with a generic attribute input check
|
||||
// E0707, // multiple elided lifetimes used in arguments of `async fn`
|
||||
// E0709, // multiple different lifetimes used in arguments of `async fn`
|
||||
// E0721, // `await` keyword
|
||||
// E0723, // unstable feature in `const` context
|
||||
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
|
||||
// E0744, // merged into E0728
|
||||
|
@ -10,9 +10,11 @@ derive_setters = "0.1.6"
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_error_codes = { path = "../rustc_error_codes" }
|
||||
rustc_error_messages = { path = "../rustc_error_messages" }
|
||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_index = { path = "../rustc_index" }
|
||||
rustc_lint_defs = { path = "../rustc_lint_defs" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
|
@ -9,8 +9,8 @@ use crate::emitter::FileWithAnnotatedLines;
|
||||
use crate::snippet::Line;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::{
|
||||
CodeSuggestion, Diagnostic, DiagnosticMessage, Emitter, FluentBundle, LazyFallbackBundle,
|
||||
Level, MultiSpan, Style, SubDiagnostic,
|
||||
CodeSuggestion, Diagnostic, DiagnosticMessage, Emitter, ErrCode, FluentBundle,
|
||||
LazyFallbackBundle, Level, MultiSpan, Style, SubDiagnostic,
|
||||
};
|
||||
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
@ -127,7 +127,7 @@ impl AnnotateSnippetEmitter {
|
||||
level: &Level,
|
||||
messages: &[(DiagnosticMessage, Style)],
|
||||
args: &FluentArgs<'_>,
|
||||
code: &Option<String>,
|
||||
code: &Option<ErrCode>,
|
||||
msp: &MultiSpan,
|
||||
_children: &[SubDiagnostic],
|
||||
_suggestions: &[CodeSuggestion],
|
||||
@ -178,6 +178,7 @@ impl AnnotateSnippetEmitter {
|
||||
.collect::<Vec<Owned>>()
|
||||
})
|
||||
.collect();
|
||||
let code = code.map(|code| code.to_string());
|
||||
let snippet = Snippet {
|
||||
title: Some(Annotation {
|
||||
label: Some(&message),
|
||||
|
39
compiler/rustc_errors/src/codes.rs
Normal file
39
compiler/rustc_errors/src/codes.rs
Normal file
@ -0,0 +1,39 @@
|
||||
//! This module defines the following.
|
||||
//! - The `ErrCode` type.
|
||||
//! - A constant for every error code, with a name like `E0123`.
|
||||
//! - A static table `DIAGNOSTICS` pairing every error code constant with its
|
||||
//! long description text.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
rustc_index::newtype_index! {
|
||||
#[max = 9999] // Because all error codes have four digits.
|
||||
#[orderable]
|
||||
#[encodable]
|
||||
#[debug_format = "ErrCode({})"]
|
||||
pub struct ErrCode {}
|
||||
}
|
||||
|
||||
impl fmt::Display for ErrCode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "E{:04}", self.as_u32())
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! define_error_code_constants_and_diagnostics_table {
|
||||
($($name:ident: $num:literal,)*) => (
|
||||
$(
|
||||
pub const $name: $crate::ErrCode = $crate::ErrCode::from_u32($num);
|
||||
)*
|
||||
pub static DIAGNOSTICS: &[($crate::ErrCode, &str)] = &[
|
||||
$( (
|
||||
$name,
|
||||
include_str!(
|
||||
concat!("../../rustc_error_codes/src/error_codes/", stringify!($name), ".md")
|
||||
)
|
||||
), )*
|
||||
];
|
||||
)
|
||||
}
|
||||
|
||||
rustc_error_codes::error_codes!(define_error_code_constants_and_diagnostics_table);
|
@ -1,7 +1,8 @@
|
||||
use crate::snippet::Style;
|
||||
use crate::{
|
||||
CodeSuggestion, DelayedBugKind, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, Level,
|
||||
MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart, SuggestionStyle,
|
||||
CodeSuggestion, DelayedBugKind, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee,
|
||||
ErrCode, Level, MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart,
|
||||
SuggestionStyle,
|
||||
};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
|
||||
use rustc_error_messages::fluent_value_from_str_list_sep_by_and;
|
||||
@ -104,7 +105,7 @@ pub struct Diagnostic {
|
||||
pub(crate) level: Level,
|
||||
|
||||
pub messages: Vec<(DiagnosticMessage, Style)>,
|
||||
pub code: Option<String>,
|
||||
pub code: Option<ErrCode>,
|
||||
pub span: MultiSpan,
|
||||
pub children: Vec<SubDiagnostic>,
|
||||
pub suggestions: Result<Vec<CodeSuggestion>, SuggestionsDisabled>,
|
||||
@ -893,8 +894,8 @@ impl Diagnostic {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn code(&mut self, s: String) -> &mut Self {
|
||||
self.code = Some(s);
|
||||
pub fn code(&mut self, code: ErrCode) -> &mut Self {
|
||||
self.code = Some(code);
|
||||
self
|
||||
}
|
||||
|
||||
@ -903,8 +904,8 @@ impl Diagnostic {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn get_code(&self) -> Option<&str> {
|
||||
self.code.as_deref()
|
||||
pub fn get_code(&self) -> Option<ErrCode> {
|
||||
self.code
|
||||
}
|
||||
|
||||
pub fn primary_message(&mut self, msg: impl Into<DiagnosticMessage>) -> &mut Self {
|
||||
@ -990,7 +991,7 @@ impl Diagnostic {
|
||||
&Level,
|
||||
&[(DiagnosticMessage, Style)],
|
||||
Vec<(&Cow<'static, str>, &DiagnosticArgValue<'static>)>,
|
||||
&Option<String>,
|
||||
&Option<ErrCode>,
|
||||
&Option<IsLint>,
|
||||
&MultiSpan,
|
||||
&Result<Vec<CodeSuggestion>, SuggestionsDisabled>,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::diagnostic::IntoDiagnosticArg;
|
||||
use crate::{DiagCtxt, Level, MultiSpan, StashKey};
|
||||
use crate::{
|
||||
Diagnostic, DiagnosticMessage, DiagnosticStyledString, ErrorGuaranteed, ExplicitBug,
|
||||
Diagnostic, DiagnosticMessage, DiagnosticStyledString, ErrCode, ErrorGuaranteed, ExplicitBug,
|
||||
SubdiagnosticMessage,
|
||||
};
|
||||
use rustc_lint_defs::Applicability;
|
||||
@ -399,7 +399,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
||||
name: String, has_future_breakage: bool,
|
||||
));
|
||||
forward!((code, with_code)(
|
||||
s: String,
|
||||
code: ErrCode,
|
||||
));
|
||||
forward!((arg, with_arg)(
|
||||
name: impl Into<Cow<'static, str>>, arg: impl IntoDiagnosticArg,
|
||||
@ -439,12 +439,7 @@ impl<G: EmissionGuarantee> Drop for DiagnosticBuilder<'_, G> {
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! struct_span_code_err {
|
||||
($dcx:expr, $span:expr, $code:ident, $($message:tt)*) => ({
|
||||
$dcx.struct_span_err($span, format!($($message)*)).with_code($crate::error_code!($code))
|
||||
($dcx:expr, $span:expr, $code:expr, $($message:tt)*) => ({
|
||||
$dcx.struct_span_err($span, format!($($message)*)).with_code($code)
|
||||
})
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! error_code {
|
||||
($code:ident) => {{ stringify!($code).to_owned() }};
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::diagnostic::DiagnosticLocation;
|
||||
use crate::{fluent_generated as fluent, AddToDiagnostic};
|
||||
use crate::{
|
||||
DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
|
||||
DiagCtxt, DiagnosticArgValue, DiagnosticBuilder, EmissionGuarantee, ErrCode, IntoDiagnostic,
|
||||
IntoDiagnosticArg, Level,
|
||||
};
|
||||
use rustc_ast as ast;
|
||||
@ -93,6 +93,7 @@ into_diagnostic_arg_using_display!(
|
||||
&TargetTriple,
|
||||
SplitDebuginfo,
|
||||
ExitStatus,
|
||||
ErrCode,
|
||||
);
|
||||
|
||||
into_diagnostic_arg_for_number!(i8, u8, i16, u16, i32, u32, i64, u64, i128, u128, isize, usize);
|
||||
|
@ -17,8 +17,8 @@ use crate::styled_buffer::StyledBuffer;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::{
|
||||
diagnostic::DiagnosticLocation, CodeSuggestion, DiagCtxt, Diagnostic, DiagnosticMessage,
|
||||
FluentBundle, LazyFallbackBundle, Level, MultiSpan, SubDiagnostic, SubstitutionHighlight,
|
||||
SuggestionStyle, TerminalUrl,
|
||||
ErrCode, FluentBundle, LazyFallbackBundle, Level, MultiSpan, SubDiagnostic,
|
||||
SubstitutionHighlight, SuggestionStyle, TerminalUrl,
|
||||
};
|
||||
use rustc_lint_defs::pluralize;
|
||||
|
||||
@ -1309,7 +1309,7 @@ impl HumanEmitter {
|
||||
msp: &MultiSpan,
|
||||
msgs: &[(DiagnosticMessage, Style)],
|
||||
args: &FluentArgs<'_>,
|
||||
code: &Option<String>,
|
||||
code: &Option<ErrCode>,
|
||||
level: &Level,
|
||||
max_line_num_len: usize,
|
||||
is_secondary: bool,
|
||||
@ -1340,9 +1340,9 @@ impl HumanEmitter {
|
||||
buffer.append(0, "[", Style::Level(*level));
|
||||
let code = if let TerminalUrl::Yes = self.terminal_url {
|
||||
let path = "https://doc.rust-lang.org/error_codes";
|
||||
Cow::Owned(format!("\x1b]8;;{path}/{code}.html\x07{code}\x1b]8;;\x07"))
|
||||
format!("\x1b]8;;{path}/{code}.html\x07{code}\x1b]8;;\x07")
|
||||
} else {
|
||||
Cow::Borrowed(code)
|
||||
code.to_string()
|
||||
};
|
||||
buffer.append(0, &code, Style::Level(*level));
|
||||
buffer.append(0, "]", Style::Level(*level));
|
||||
@ -2076,7 +2076,7 @@ impl HumanEmitter {
|
||||
level: &Level,
|
||||
messages: &[(DiagnosticMessage, Style)],
|
||||
args: &FluentArgs<'_>,
|
||||
code: &Option<String>,
|
||||
code: &Option<ErrCode>,
|
||||
span: &MultiSpan,
|
||||
children: &[SubDiagnostic],
|
||||
suggestions: &[CodeSuggestion],
|
||||
|
@ -400,10 +400,10 @@ impl Diagnostic {
|
||||
|
||||
let translated_message = je.translate_messages(&diag.messages, &args);
|
||||
|
||||
let code = if let Some(code) = &diag.code {
|
||||
let code = if let Some(code) = diag.code {
|
||||
Some(DiagnosticCode {
|
||||
code: code.to_string(),
|
||||
explanation: je.registry.as_ref().unwrap().try_find_description(&code).ok(),
|
||||
explanation: je.registry.as_ref().unwrap().try_find_description(code).ok(),
|
||||
})
|
||||
} else if let Some(IsLint { name, .. }) = &diag.is_lint {
|
||||
Some(DiagnosticCode { code: name.to_string(), explanation: None })
|
||||
|
@ -14,6 +14,7 @@
|
||||
#![feature(error_reporter)]
|
||||
#![feature(extract_if)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(negative_impls)]
|
||||
#![feature(never_type)]
|
||||
#![feature(rustc_attrs)]
|
||||
@ -30,6 +31,7 @@ extern crate tracing;
|
||||
|
||||
extern crate self as rustc_errors;
|
||||
|
||||
pub use codes::*;
|
||||
pub use diagnostic::{
|
||||
AddToDiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgValue,
|
||||
DiagnosticStyledString, IntoDiagnosticArg, SubDiagnostic,
|
||||
@ -78,6 +80,7 @@ use std::path::{Path, PathBuf};
|
||||
use Level::*;
|
||||
|
||||
pub mod annotate_snippet_emitter_writer;
|
||||
pub mod codes;
|
||||
mod diagnostic;
|
||||
mod diagnostic_builder;
|
||||
mod diagnostic_impls;
|
||||
@ -446,10 +449,10 @@ struct DiagCtxtInner {
|
||||
/// This set contains the code of all emitted diagnostics to avoid
|
||||
/// emitting the same diagnostic with extended help (`--teach`) twice, which
|
||||
/// would be unnecessary repetition.
|
||||
taught_diagnostics: FxHashSet<String>,
|
||||
taught_diagnostics: FxHashSet<ErrCode>,
|
||||
|
||||
/// Used to suggest rustc --explain `<error code>`
|
||||
emitted_diagnostic_codes: FxIndexSet<String>,
|
||||
emitted_diagnostic_codes: FxIndexSet<ErrCode>,
|
||||
|
||||
/// This set contains a hash of every diagnostic that has been emitted by
|
||||
/// this `DiagCtxt`. These hashes is used to avoid emitting the same error
|
||||
@ -1004,9 +1007,9 @@ impl DiagCtxt {
|
||||
let mut error_codes = inner
|
||||
.emitted_diagnostic_codes
|
||||
.iter()
|
||||
.filter_map(|code| {
|
||||
.filter_map(|&code| {
|
||||
if registry.try_find_description(code).is_ok().clone() {
|
||||
Some(code.clone())
|
||||
Some(code.to_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -1052,8 +1055,8 @@ impl DiagCtxt {
|
||||
///
|
||||
/// Used to suppress emitting the same error multiple times with extended explanation when
|
||||
/// calling `-Zteach`.
|
||||
pub fn must_teach(&self, code: &str) -> bool {
|
||||
self.inner.borrow_mut().taught_diagnostics.insert(code.to_string())
|
||||
pub fn must_teach(&self, code: ErrCode) -> bool {
|
||||
self.inner.borrow_mut().taught_diagnostics.insert(code)
|
||||
}
|
||||
|
||||
pub fn force_print_diagnostic(&self, db: Diagnostic) {
|
||||
@ -1313,8 +1316,8 @@ impl DiagCtxtInner {
|
||||
|
||||
let mut guaranteed = None;
|
||||
(*TRACK_DIAGNOSTIC)(diagnostic, &mut |mut diagnostic| {
|
||||
if let Some(ref code) = diagnostic.code {
|
||||
self.emitted_diagnostic_codes.insert(code.clone());
|
||||
if let Some(code) = diagnostic.code {
|
||||
self.emitted_diagnostic_codes.insert(code);
|
||||
}
|
||||
|
||||
let already_emitted = {
|
||||
|
@ -1,3 +1,4 @@
|
||||
use crate::ErrCode;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -5,17 +6,17 @@ pub struct InvalidErrorCode;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Registry {
|
||||
long_descriptions: FxHashMap<&'static str, &'static str>,
|
||||
long_descriptions: FxHashMap<ErrCode, &'static str>,
|
||||
}
|
||||
|
||||
impl Registry {
|
||||
pub fn new(long_descriptions: &[(&'static str, &'static str)]) -> Registry {
|
||||
pub fn new(long_descriptions: &[(ErrCode, &'static str)]) -> Registry {
|
||||
Registry { long_descriptions: long_descriptions.iter().copied().collect() }
|
||||
}
|
||||
|
||||
/// Returns `InvalidErrorCode` if the code requested does not exist in the
|
||||
/// registry.
|
||||
pub fn try_find_description(&self, code: &str) -> Result<&'static str, InvalidErrorCode> {
|
||||
self.long_descriptions.get(code).copied().ok_or(InvalidErrorCode)
|
||||
pub fn try_find_description(&self, code: ErrCode) -> Result<&'static str, InvalidErrorCode> {
|
||||
self.long_descriptions.get(&code).copied().ok_or(InvalidErrorCode)
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
use rustc_ast::ast;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
|
||||
@ -175,7 +176,7 @@ pub(crate) struct TakesNoArguments<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_feature_removed, code = "E0557")]
|
||||
#[diag(expand_feature_removed, code = E0557)]
|
||||
pub(crate) struct FeatureRemoved<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -191,7 +192,7 @@ pub(crate) struct FeatureRemovedReason<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_feature_not_allowed, code = "E0725")]
|
||||
#[diag(expand_feature_not_allowed, code = E0725)]
|
||||
pub(crate) struct FeatureNotAllowed {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -210,7 +211,7 @@ pub(crate) struct RecursionLimitReached<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_malformed_feature_attribute, code = "E0556")]
|
||||
#[diag(expand_malformed_feature_attribute, code = E0556)]
|
||||
pub(crate) struct MalformedFeatureAttribute {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -347,7 +348,7 @@ pub(crate) struct ModuleInBlockName {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_module_file_not_found, code = "E0583")]
|
||||
#[diag(expand_module_file_not_found, code = E0583)]
|
||||
#[help]
|
||||
#[note]
|
||||
pub(crate) struct ModuleFileNotFound {
|
||||
@ -359,7 +360,7 @@ pub(crate) struct ModuleFileNotFound {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(expand_module_multiple_candidates, code = "E0761")]
|
||||
#[diag(expand_module_multiple_candidates, code = E0761)]
|
||||
#[help]
|
||||
pub(crate) struct ModuleMultipleCandidates {
|
||||
#[primary_span]
|
||||
|
@ -1,5 +1,5 @@
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
|
@ -7,7 +7,9 @@ use crate::fluent_generated as fluent;
|
||||
use crate::traits::error_reporting::report_object_safety_error;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_errors::{pluralize, struct_span_code_err, Applicability, Diagnostic, ErrorGuaranteed};
|
||||
use rustc_errors::{
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, ErrorGuaranteed,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_infer::traits::FulfillmentError;
|
||||
|
@ -5,7 +5,9 @@ use crate::astconv::{
|
||||
};
|
||||
use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs};
|
||||
use rustc_ast::ast::ParamKindOrd;
|
||||
use rustc_errors::{struct_span_code_err, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan};
|
||||
use rustc_errors::{
|
||||
codes::*, struct_span_code_err, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use rustc_ast::TraitObjectSyntax;
|
||||
use rustc_errors::{Diagnostic, StashKey};
|
||||
use rustc_errors::{codes::*, Diagnostic, StashKey};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_lint_defs::{builtin::BARE_TRAIT_OBJECTS, Applicability};
|
||||
|
@ -18,8 +18,8 @@ use crate::require_c_abi_if_c_variadic;
|
||||
use rustc_ast::TraitObjectSyntax;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::{
|
||||
error_code, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
ErrorGuaranteed, FatalError, MultiSpan,
|
||||
codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
|
||||
FatalError, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
|
||||
@ -1072,9 +1072,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
if let Some(binding) = binding
|
||||
&& let ConvertedBindingKind::Equality(_) = binding.kind
|
||||
{
|
||||
error_code!(E0222)
|
||||
E0222
|
||||
} else {
|
||||
error_code!(E0221)
|
||||
E0221
|
||||
},
|
||||
);
|
||||
|
||||
@ -1630,7 +1630,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
let reported = tcx
|
||||
.dcx()
|
||||
.struct_span_err(span, msg)
|
||||
.with_code(rustc_errors::error_code!(E0624))
|
||||
.with_code(E0624)
|
||||
.with_span_label(span, format!("private {kind}"))
|
||||
.with_span_label(def_span, format!("{kind} defined here"))
|
||||
.emit();
|
||||
|
@ -2,7 +2,7 @@ use crate::astconv::{GenericArgCountMismatch, GenericArgCountResult, OnlySelfBou
|
||||
use crate::bounds::Bounds;
|
||||
use crate::errors::TraitObjectDeclaredWithNoTraits;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -5,7 +5,7 @@ use super::compare_impl_item::check_type_bounds;
|
||||
use super::compare_impl_item::{compare_impl_method, compare_impl_ty};
|
||||
use super::*;
|
||||
use rustc_attr as attr;
|
||||
use rustc_errors::{ErrorGuaranteed, MultiSpan};
|
||||
use rustc_errors::{codes::*, ErrorGuaranteed, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
|
@ -2,7 +2,7 @@ use super::potentially_plural_count;
|
||||
use crate::errors::LifetimesOrBoundsMismatchOnTrait;
|
||||
use hir::def_id::{DefId, DefIdMap, LocalDefId};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
|
||||
use rustc_errors::{pluralize, struct_span_code_err, Applicability, ErrorGuaranteed};
|
||||
use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, ErrorGuaranteed};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::intravisit;
|
||||
@ -1382,7 +1382,7 @@ fn compare_number_of_generics<'tcx>(
|
||||
kind = kind,
|
||||
),
|
||||
);
|
||||
err.code("E0049".into());
|
||||
err.code(E0049);
|
||||
|
||||
let msg =
|
||||
format!("expected {trait_count} {kind} parameter{}", pluralize!(trait_count),);
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// We don't do any drop checking during hir typeck.
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{struct_span_code_err, ErrorGuaranteed};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
|
||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||
use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
|
||||
use rustc_middle::ty::util::CheckRegions;
|
||||
|
@ -8,7 +8,7 @@ use crate::errors::{
|
||||
};
|
||||
|
||||
use hir::def_id::DefId;
|
||||
use rustc_errors::{struct_span_code_err, DiagnosticMessage};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, DiagnosticMessage};
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
|
@ -4,7 +4,7 @@ use crate::constrained_generic_params::{identify_constrained_generic_params, Par
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
|
||||
use rustc_errors::{
|
||||
pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
|
||||
|
@ -1,5 +1,5 @@
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -6,7 +6,7 @@
|
||||
// mappings. That mapping code resides here.
|
||||
|
||||
use crate::errors;
|
||||
use rustc_errors::{error_code, struct_span_code_err};
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
|
||||
@ -61,7 +61,7 @@ fn enforce_trait_manually_implementable(
|
||||
// Maintain explicit error code for `Unsize`, since it has a useful
|
||||
// explanation about using `CoerceUnsized` instead.
|
||||
if Some(trait_def_id) == tcx.lang_items().unsize_trait() {
|
||||
err.code(error_code!(E0328));
|
||||
err.code(E0328);
|
||||
}
|
||||
|
||||
return Err(err.emit());
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Unsafety checker: every impl either implements a trait defined in this
|
||||
//! crate or pertains to a type defined in this crate.
|
||||
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::Unsafety;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
use rustc_ast::walk_list;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{
|
||||
error_code, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
|
||||
Level, MultiSpan,
|
||||
codes::*, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
MultiSpan,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::Ty;
|
||||
@ -52,7 +52,7 @@ pub struct AssocKindMismatchWrapInBracesSugg {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_assoc_item_not_found, code = "E0220")]
|
||||
#[diag(hir_analysis_assoc_item_not_found, code = E0220)]
|
||||
pub struct AssocItemNotFound<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -122,7 +122,7 @@ pub enum AssocItemNotFoundSugg<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_unrecognized_atomic_operation, code = "E0092")]
|
||||
#[diag(hir_analysis_unrecognized_atomic_operation, code = E0092)]
|
||||
pub struct UnrecognizedAtomicOperation<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -131,7 +131,7 @@ pub struct UnrecognizedAtomicOperation<'a> {
|
||||
}
|
||||
|
||||
#[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> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -142,7 +142,7 @@ pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_unrecognized_intrinsic_function, code = "E0093")]
|
||||
#[diag(hir_analysis_unrecognized_intrinsic_function, code = E0093)]
|
||||
pub struct UnrecognizedIntrinsicFunction {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -151,7 +151,7 @@ pub struct UnrecognizedIntrinsicFunction {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -178,7 +178,7 @@ pub struct AsyncTraitImplShouldBeAsync {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -186,7 +186,7 @@ pub struct DropImplOnWrongItem {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_field_already_declared, code = "E0124")]
|
||||
#[diag(hir_analysis_field_already_declared, code = E0124)]
|
||||
pub struct FieldAlreadyDeclared {
|
||||
pub field_name: Ident,
|
||||
#[primary_span]
|
||||
@ -197,7 +197,7 @@ pub struct FieldAlreadyDeclared {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -205,14 +205,14 @@ pub struct CopyImplOnTypeWithDtor {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_multiple_relaxed_default_bounds, code = "E0203")]
|
||||
#[diag(hir_analysis_multiple_relaxed_default_bounds, code = E0203)]
|
||||
pub struct MultipleRelaxedDefaultBounds {
|
||||
#[primary_span]
|
||||
pub spans: Vec<Span>,
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -228,7 +228,7 @@ pub struct ConstParamTyImplOnNonAdt {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -237,14 +237,14 @@ pub struct TraitObjectDeclaredWithNoTraits {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_ambiguous_lifetime_bound, code = "E0227")]
|
||||
#[diag(hir_analysis_ambiguous_lifetime_bound, code = E0227)]
|
||||
pub struct AmbiguousLifetimeBound {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -264,7 +264,7 @@ pub struct ParenthesizedFnTraitExpansion {
|
||||
}
|
||||
|
||||
#[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 ty: Ty<'tcx>,
|
||||
#[primary_span]
|
||||
@ -275,7 +275,7 @@ pub struct TypeofReservedKeywordUsed<'tcx> {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -320,7 +320,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for MissingTypeParams {
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
let mut err = DiagnosticBuilder::new(dcx, level, fluent::hir_analysis_missing_type_params);
|
||||
err.span(self.span);
|
||||
err.code(error_code!(E0393));
|
||||
err.code(E0393);
|
||||
err.arg("parameterCount", self.missing_type_params.len());
|
||||
err.arg(
|
||||
"parameters",
|
||||
@ -373,7 +373,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for MissingTypeParams {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_manual_implementation, code = "E0183")]
|
||||
#[diag(hir_analysis_manual_implementation, code = E0183)]
|
||||
#[help]
|
||||
pub struct ManualImplementation {
|
||||
#[primary_span]
|
||||
@ -421,7 +421,7 @@ pub struct SelfInImplSelf {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_linkage_type, code = "E0791")]
|
||||
#[diag(hir_analysis_linkage_type, code = E0791)]
|
||||
pub(crate) struct LinkageType {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -429,7 +429,7 @@ pub(crate) struct LinkageType {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[help]
|
||||
#[diag(hir_analysis_auto_deref_reached_recursion_limit, code = "E0055")]
|
||||
#[diag(hir_analysis_auto_deref_reached_recursion_limit, code = E0055)]
|
||||
pub struct AutoDerefReachedRecursionLimit<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -440,7 +440,7 @@ pub struct AutoDerefReachedRecursionLimit<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_where_clause_on_main, code = "E0646")]
|
||||
#[diag(hir_analysis_where_clause_on_main, code = E0646)]
|
||||
pub(crate) struct WhereClauseOnMain {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -485,7 +485,7 @@ pub(crate) struct StartTargetFeature {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_start_not_async, code = "E0752")]
|
||||
#[diag(hir_analysis_start_not_async, code = E0752)]
|
||||
pub(crate) struct StartAsync {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -493,7 +493,7 @@ pub(crate) struct StartAsync {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_start_function_where, code = "E0647")]
|
||||
#[diag(hir_analysis_start_function_where, code = E0647)]
|
||||
pub(crate) struct StartFunctionWhere {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -501,7 +501,7 @@ pub(crate) struct StartFunctionWhere {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_start_function_parameters, code = "E0132")]
|
||||
#[diag(hir_analysis_start_function_parameters, code = E0132)]
|
||||
pub(crate) struct StartFunctionParameters {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -509,14 +509,14 @@ pub(crate) struct StartFunctionParameters {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_main_function_return_type_generic, code = "E0131")]
|
||||
#[diag(hir_analysis_main_function_return_type_generic, code = E0131)]
|
||||
pub(crate) struct MainFunctionReturnTypeGeneric {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_main_function_async, code = "E0752")]
|
||||
#[diag(hir_analysis_main_function_async, code = E0752)]
|
||||
pub(crate) struct MainFunctionAsync {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -525,7 +525,7 @@ pub(crate) struct MainFunctionAsync {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_main_function_generic_parameters, code = "E0131")]
|
||||
#[diag(hir_analysis_main_function_generic_parameters, code = E0131)]
|
||||
pub(crate) struct MainFunctionGenericParameters {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -534,7 +534,7 @@ pub(crate) struct MainFunctionGenericParameters {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_variadic_function_compatible_convention, code = "E0045")]
|
||||
#[diag(hir_analysis_variadic_function_compatible_convention, code = E0045)]
|
||||
pub(crate) struct VariadicFunctionCompatibleConvention<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -587,7 +587,7 @@ pub(crate) struct TypeOf<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_pass_to_variadic_function, code = "E0617")]
|
||||
#[diag(hir_analysis_pass_to_variadic_function, code = E0617)]
|
||||
pub(crate) struct PassToVariadicFunction<'tcx, 'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -601,7 +601,7 @@ pub(crate) struct PassToVariadicFunction<'tcx, 'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_cast_thin_pointer_to_fat_pointer, code = "E0607")]
|
||||
#[diag(hir_analysis_cast_thin_pointer_to_fat_pointer, code = E0607)]
|
||||
pub(crate) struct CastThinPointerToFatPointer<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -610,7 +610,7 @@ pub(crate) struct CastThinPointerToFatPointer<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_invalid_union_field, code = "E0740")]
|
||||
#[diag(hir_analysis_invalid_union_field, code = E0740)]
|
||||
pub(crate) struct InvalidUnionField {
|
||||
#[primary_span]
|
||||
pub field_span: Span,
|
||||
@ -649,7 +649,7 @@ pub(crate) struct ReturnTypeNotationEqualityBound {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_placeholder_not_allowed_item_signatures, code = "E0121")]
|
||||
#[diag(hir_analysis_placeholder_not_allowed_item_signatures, code = E0121)]
|
||||
pub(crate) struct PlaceholderNotAllowedItemSignatures {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -658,7 +658,7 @@ pub(crate) struct PlaceholderNotAllowedItemSignatures {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_associated_type_trait_uninferred_generic_params, code = "E0212")]
|
||||
#[diag(hir_analysis_associated_type_trait_uninferred_generic_params, code = E0212)]
|
||||
pub(crate) struct AssociatedTypeTraitUninferredGenericParams {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -684,7 +684,7 @@ pub(crate) struct AssociatedTypeTraitUninferredGenericParamsMultipartSuggestion
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_enum_discriminant_overflowed, code = "E0370")]
|
||||
#[diag(hir_analysis_enum_discriminant_overflowed, code = E0370)]
|
||||
#[note]
|
||||
pub(crate) struct EnumDiscriminantOverflowed {
|
||||
#[primary_span]
|
||||
@ -774,7 +774,7 @@ pub(crate) struct SIMDFFIHighlyExperimental {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum ImplNotMarkedDefault {
|
||||
#[diag(hir_analysis_impl_not_marked_default, code = "E0520")]
|
||||
#[diag(hir_analysis_impl_not_marked_default, code = E0520)]
|
||||
#[note]
|
||||
Ok {
|
||||
#[primary_span]
|
||||
@ -784,7 +784,7 @@ pub enum ImplNotMarkedDefault {
|
||||
ok_label: Span,
|
||||
ident: Symbol,
|
||||
},
|
||||
#[diag(hir_analysis_impl_not_marked_default_err, code = "E0520")]
|
||||
#[diag(hir_analysis_impl_not_marked_default_err, code = E0520)]
|
||||
#[note]
|
||||
Err {
|
||||
#[primary_span]
|
||||
@ -795,7 +795,7 @@ pub enum ImplNotMarkedDefault {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_missing_trait_item, code = "E0046")]
|
||||
#[diag(hir_analysis_missing_trait_item, code = E0046)]
|
||||
pub(crate) struct MissingTraitItem {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -846,7 +846,7 @@ pub(crate) struct MissingTraitItemSuggestionNone {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_missing_one_of_trait_item, code = "E0046")]
|
||||
#[diag(hir_analysis_missing_one_of_trait_item, code = E0046)]
|
||||
pub(crate) struct MissingOneOfTraitItem {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -857,7 +857,7 @@ pub(crate) struct MissingOneOfTraitItem {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_missing_trait_item_unstable, code = "E0046")]
|
||||
#[diag(hir_analysis_missing_trait_item_unstable, code = E0046)]
|
||||
#[note]
|
||||
pub(crate) struct MissingTraitItemUnstable {
|
||||
#[primary_span]
|
||||
@ -872,7 +872,7 @@ pub(crate) struct MissingTraitItemUnstable {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_transparent_enum_variant, code = "E0731")]
|
||||
#[diag(hir_analysis_transparent_enum_variant, code = E0731)]
|
||||
pub(crate) struct TransparentEnumVariant {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -886,7 +886,7 @@ pub(crate) struct TransparentEnumVariant {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_transparent_non_zero_sized_enum, code = "E0690")]
|
||||
#[diag(hir_analysis_transparent_non_zero_sized_enum, code = E0690)]
|
||||
pub(crate) struct TransparentNonZeroSizedEnum<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -898,7 +898,7 @@ pub(crate) struct TransparentNonZeroSizedEnum<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_transparent_non_zero_sized, code = "E0690")]
|
||||
#[diag(hir_analysis_transparent_non_zero_sized, code = E0690)]
|
||||
pub(crate) struct TransparentNonZeroSized<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1045,7 +1045,7 @@ pub(crate) struct ReturnPositionImplTraitInTraitRefined<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_ty_outside, code = "E0390")]
|
||||
#[diag(hir_analysis_inherent_ty_outside, code = E0390)]
|
||||
#[help]
|
||||
pub struct InherentTyOutside {
|
||||
#[primary_span]
|
||||
@ -1054,7 +1054,7 @@ pub struct InherentTyOutside {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = "E0378")]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
||||
pub struct DispatchFromDynCoercion<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1066,14 +1066,14 @@ pub struct DispatchFromDynCoercion<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_repr, code = "E0378")]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_repr, code = E0378)]
|
||||
pub struct DispatchFromDynRepr {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_ty_outside_relevant, code = "E0390")]
|
||||
#[diag(hir_analysis_inherent_ty_outside_relevant, code = E0390)]
|
||||
#[help]
|
||||
pub struct InherentTyOutsideRelevant {
|
||||
#[primary_span]
|
||||
@ -1083,7 +1083,7 @@ pub struct InherentTyOutsideRelevant {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_ty_outside_new, code = "E0116")]
|
||||
#[diag(hir_analysis_inherent_ty_outside_new, code = E0116)]
|
||||
#[note]
|
||||
pub struct InherentTyOutsideNew {
|
||||
#[primary_span]
|
||||
@ -1092,7 +1092,7 @@ pub struct InherentTyOutsideNew {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_ty_outside_primitive, code = "E0390")]
|
||||
#[diag(hir_analysis_inherent_ty_outside_primitive, code = E0390)]
|
||||
#[help]
|
||||
pub struct InherentTyOutsidePrimitive {
|
||||
#[primary_span]
|
||||
@ -1102,7 +1102,7 @@ pub struct InherentTyOutsidePrimitive {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_primitive_ty, code = "E0390")]
|
||||
#[diag(hir_analysis_inherent_primitive_ty, code = E0390)]
|
||||
#[help]
|
||||
pub struct InherentPrimitiveTy<'a> {
|
||||
#[primary_span]
|
||||
@ -1118,7 +1118,7 @@ pub struct InherentPrimitiveTyNote<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_dyn, code = "E0785")]
|
||||
#[diag(hir_analysis_inherent_dyn, code = E0785)]
|
||||
#[note]
|
||||
pub struct InherentDyn {
|
||||
#[primary_span]
|
||||
@ -1127,7 +1127,7 @@ pub struct InherentDyn {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_nominal, code = "E0118")]
|
||||
#[diag(hir_analysis_inherent_nominal, code = E0118)]
|
||||
#[note]
|
||||
pub struct InherentNominal {
|
||||
#[primary_span]
|
||||
@ -1136,7 +1136,7 @@ pub struct InherentNominal {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_zst, code = "E0378")]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_zst, code = E0378)]
|
||||
#[note]
|
||||
pub struct DispatchFromDynZST<'a> {
|
||||
#[primary_span]
|
||||
@ -1146,7 +1146,7 @@ pub struct DispatchFromDynZST<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = "E0378")]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
||||
pub struct DispatchFromDynSingle<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1156,7 +1156,7 @@ pub struct DispatchFromDynSingle<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_multi, code = "E0378")]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_multi, code = E0378)]
|
||||
#[note]
|
||||
pub struct DispatchFromDynMulti {
|
||||
#[primary_span]
|
||||
@ -1168,7 +1168,7 @@ pub struct DispatchFromDynMulti {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = "E0376")]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0376)]
|
||||
pub struct DispatchFromDynStruct<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1176,7 +1176,7 @@ pub struct DispatchFromDynStruct<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = "E0377")]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0377)]
|
||||
pub struct DispatchFromDynSame<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1188,7 +1188,7 @@ pub struct DispatchFromDynSame<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = "E0374")]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0374)]
|
||||
pub struct CoerceUnsizedOneField<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1198,7 +1198,7 @@ pub struct CoerceUnsizedOneField<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_multi, code = "E0375")]
|
||||
#[diag(hir_analysis_coerce_unsized_multi, code = E0375)]
|
||||
#[note]
|
||||
pub struct CoerceUnsizedMulti {
|
||||
#[primary_span]
|
||||
@ -1211,7 +1211,7 @@ pub struct CoerceUnsizedMulti {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = "E0378")]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
||||
pub struct CoerceUnsizedMay<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1219,7 +1219,7 @@ pub struct CoerceUnsizedMay<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_trait_cannot_impl_for_ty, code = "E0204")]
|
||||
#[diag(hir_analysis_trait_cannot_impl_for_ty, code = E0204)]
|
||||
pub struct TraitCannotImplForTy {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1241,7 +1241,7 @@ pub struct ImplForTyRequires {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_traits_with_defualt_impl, code = "E0321")]
|
||||
#[diag(hir_analysis_traits_with_defualt_impl, code = E0321)]
|
||||
#[note]
|
||||
pub struct TraitsWithDefaultImpl<'a> {
|
||||
#[primary_span]
|
||||
@ -1252,7 +1252,7 @@ pub struct TraitsWithDefaultImpl<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_cross_crate_traits, code = "E0321")]
|
||||
#[diag(hir_analysis_cross_crate_traits, code = E0321)]
|
||||
pub struct CrossCrateTraits<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1262,7 +1262,7 @@ pub struct CrossCrateTraits<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_cross_crate_traits_defined, code = "E0321")]
|
||||
#[diag(hir_analysis_cross_crate_traits_defined, code = E0321)]
|
||||
pub struct CrossCrateTraitsDefined {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1271,7 +1271,7 @@ pub struct CrossCrateTraitsDefined {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_ty_param_first_local, code = "E0210")]
|
||||
#[diag(hir_analysis_ty_param_first_local, code = E0210)]
|
||||
#[note]
|
||||
pub struct TyParamFirstLocal<'a> {
|
||||
#[primary_span]
|
||||
@ -1284,7 +1284,7 @@ pub struct TyParamFirstLocal<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_ty_param_some, code = "E0210")]
|
||||
#[diag(hir_analysis_ty_param_some, code = E0210)]
|
||||
#[note]
|
||||
pub struct TyParamSome<'a> {
|
||||
#[primary_span]
|
||||
@ -1297,7 +1297,7 @@ pub struct TyParamSome<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum OnlyCurrentTraits<'a> {
|
||||
#[diag(hir_analysis_only_current_traits_outside, code = "E0117")]
|
||||
#[diag(hir_analysis_only_current_traits_outside, code = E0117)]
|
||||
Outside {
|
||||
#[primary_span]
|
||||
#[label(hir_analysis_only_current_traits_label)]
|
||||
@ -1317,7 +1317,7 @@ pub enum OnlyCurrentTraits<'a> {
|
||||
#[subdiagnostic]
|
||||
sugg: Option<OnlyCurrentTraitsPointerSugg<'a>>,
|
||||
},
|
||||
#[diag(hir_analysis_only_current_traits_primitive, code = "E0117")]
|
||||
#[diag(hir_analysis_only_current_traits_primitive, code = E0117)]
|
||||
Primitive {
|
||||
#[primary_span]
|
||||
#[label(hir_analysis_only_current_traits_label)]
|
||||
@ -1337,7 +1337,7 @@ pub enum OnlyCurrentTraits<'a> {
|
||||
#[subdiagnostic]
|
||||
sugg: Option<OnlyCurrentTraitsPointerSugg<'a>>,
|
||||
},
|
||||
#[diag(hir_analysis_only_current_traits_arbitrary, code = "E0117")]
|
||||
#[diag(hir_analysis_only_current_traits_arbitrary, code = E0117)]
|
||||
Arbitrary {
|
||||
#[primary_span]
|
||||
#[label(hir_analysis_only_current_traits_label)]
|
||||
@ -1412,7 +1412,7 @@ pub struct OnlyCurrentTraitsPointerSugg<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_static_mut_ref, code = "E0796")]
|
||||
#[diag(hir_analysis_static_mut_ref, code = E0796)]
|
||||
#[note]
|
||||
pub struct StaticMutRef {
|
||||
#[primary_span]
|
||||
|
@ -12,7 +12,7 @@ use crate::constrained_generic_params as cgp;
|
||||
use min_specialization::check_min_specialization;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{LocalDefId, LocalModDefId};
|
||||
use rustc_middle::query::Providers;
|
||||
|
@ -6,18 +6,18 @@ pub use self::{
|
||||
missing_cast_for_variadic_arg::*, sized_unsized_cast::*, wrong_number_of_generic_args::*,
|
||||
};
|
||||
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
use rustc_errors::{DiagnosticBuilder, ErrCode};
|
||||
use rustc_session::Session;
|
||||
|
||||
pub trait StructuredDiagnostic<'tcx> {
|
||||
fn session(&self) -> &Session;
|
||||
|
||||
fn code(&self) -> String;
|
||||
fn code(&self) -> ErrCode;
|
||||
|
||||
fn diagnostic(&self) -> DiagnosticBuilder<'tcx> {
|
||||
let err = self.diagnostic_common();
|
||||
|
||||
if self.session().teach(&self.code()) {
|
||||
if self.session().teach(self.code()) {
|
||||
self.diagnostic_extended(err)
|
||||
} else {
|
||||
self.diagnostic_regular(err)
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{errors, structured_errors::StructuredDiagnostic};
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder, ErrCode};
|
||||
use rustc_middle::ty::{Ty, TypeVisitableExt};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::Span;
|
||||
@ -16,8 +16,8 @@ impl<'tcx> StructuredDiagnostic<'tcx> for MissingCastForVariadicArg<'tcx, '_> {
|
||||
self.sess
|
||||
}
|
||||
|
||||
fn code(&self) -> String {
|
||||
rustc_errors::error_code!(E0617)
|
||||
fn code(&self) -> ErrCode {
|
||||
E0617
|
||||
}
|
||||
|
||||
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{errors, structured_errors::StructuredDiagnostic};
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder, ErrCode};
|
||||
use rustc_middle::ty::{Ty, TypeVisitableExt};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::Span;
|
||||
@ -16,8 +16,8 @@ impl<'tcx> StructuredDiagnostic<'tcx> for SizedUnsizedCast<'tcx> {
|
||||
self.sess
|
||||
}
|
||||
|
||||
fn code(&self) -> String {
|
||||
rustc_errors::error_code!(E0607)
|
||||
fn code(&self) -> ErrCode {
|
||||
E0607
|
||||
}
|
||||
|
||||
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
|
||||
|
@ -1,5 +1,7 @@
|
||||
use crate::structured_errors::StructuredDiagnostic;
|
||||
use rustc_errors::{pluralize, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan};
|
||||
use rustc_errors::{
|
||||
codes::*, pluralize, Applicability, Diagnostic, DiagnosticBuilder, ErrCode, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::ty::{self as ty, AssocItems, AssocKind, TyCtxt};
|
||||
use rustc_session::Session;
|
||||
@ -1105,8 +1107,8 @@ impl<'tcx> StructuredDiagnostic<'tcx> for WrongNumberOfGenericArgs<'_, 'tcx> {
|
||||
self.tcx.sess
|
||||
}
|
||||
|
||||
fn code(&self) -> String {
|
||||
rustc_errors::error_code!(E0107)
|
||||
fn code(&self) -> ErrCode {
|
||||
E0107
|
||||
}
|
||||
|
||||
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
|
||||
|
@ -33,7 +33,7 @@ use super::FnCtxt;
|
||||
use crate::errors;
|
||||
use crate::type_error_struct;
|
||||
use hir::ExprKind;
|
||||
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed};
|
||||
use rustc_errors::{codes::*, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed};
|
||||
use rustc_hir as hir;
|
||||
use rustc_macros::{TypeFoldable, TypeVisitable};
|
||||
use rustc_middle::mir::Mutability;
|
||||
|
@ -36,7 +36,9 @@
|
||||
//! ```
|
||||
|
||||
use crate::FnCtxt;
|
||||
use rustc_errors::{struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan};
|
||||
use rustc_errors::{
|
||||
codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
|
@ -3,8 +3,8 @@ use std::borrow::Cow;
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{
|
||||
AddToDiagnostic, Applicability, Diagnostic, DiagnosticArgValue, IntoDiagnosticArg, MultiSpan,
|
||||
SubdiagnosticMessage,
|
||||
codes::*, AddToDiagnostic, Applicability, Diagnostic, DiagnosticArgValue, IntoDiagnosticArg,
|
||||
MultiSpan, SubdiagnosticMessage,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::Ty;
|
||||
@ -15,7 +15,7 @@ use rustc_span::{
|
||||
};
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_field_multiply_specified_in_initializer, code = "E0062")]
|
||||
#[diag(hir_typeck_field_multiply_specified_in_initializer, code = E0062)]
|
||||
pub struct FieldMultiplySpecifiedInInitializer {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -26,7 +26,7 @@ pub struct FieldMultiplySpecifiedInInitializer {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_return_stmt_outside_of_fn_body, code = "E0572")]
|
||||
#[diag(hir_typeck_return_stmt_outside_of_fn_body, code = E0572)]
|
||||
pub struct ReturnStmtOutsideOfFnBody {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -62,14 +62,14 @@ pub struct RustCallIncorrectArgs {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_yield_expr_outside_of_coroutine, code = "E0627")]
|
||||
#[diag(hir_typeck_yield_expr_outside_of_coroutine, code = E0627)]
|
||||
pub struct YieldExprOutsideOfCoroutine {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_struct_expr_non_exhaustive, code = "E0639")]
|
||||
#[diag(hir_typeck_struct_expr_non_exhaustive, code = E0639)]
|
||||
pub struct StructExprNonExhaustive {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -77,7 +77,7 @@ pub struct StructExprNonExhaustive {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_method_call_on_unknown_raw_pointee, code = "E0699")]
|
||||
#[diag(hir_typeck_method_call_on_unknown_raw_pointee, code = E0699)]
|
||||
pub struct MethodCallOnUnknownRawPointee {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -92,14 +92,14 @@ pub struct MissingFnLangItems {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_functional_record_update_on_non_struct, code = "E0436")]
|
||||
#[diag(hir_typeck_functional_record_update_on_non_struct, code = E0436)]
|
||||
pub struct FunctionalRecordUpdateOnNonStruct {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_address_of_temporary_taken, code = "E0745")]
|
||||
#[diag(hir_typeck_address_of_temporary_taken, code = E0745)]
|
||||
pub struct AddressOfTemporaryTaken {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -145,7 +145,7 @@ pub enum ExpectedReturnTypeLabel<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_explicit_destructor, code = "E0040")]
|
||||
#[diag(hir_typeck_explicit_destructor, code = E0040)]
|
||||
pub struct ExplicitDestructorCall {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -168,7 +168,7 @@ pub enum ExplicitDestructorCallSugg {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_missing_parentheses_in_range, code = "E0689")]
|
||||
#[diag(hir_typeck_missing_parentheses_in_range, code = E0689)]
|
||||
pub struct MissingParenthesesInRange {
|
||||
#[primary_span]
|
||||
#[label(hir_typeck_missing_parentheses_in_range)]
|
||||
@ -321,7 +321,7 @@ impl HelpUseLatestEdition {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_invalid_callee, code = "E0618")]
|
||||
#[diag(hir_typeck_invalid_callee, code = E0618)]
|
||||
pub struct InvalidCallee {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -329,7 +329,7 @@ pub struct InvalidCallee {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_int_to_fat, code = "E0606")]
|
||||
#[diag(hir_typeck_int_to_fat, code = E0606)]
|
||||
pub struct IntToWide<'tcx> {
|
||||
#[primary_span]
|
||||
#[label(hir_typeck_int_to_fat_label)]
|
||||
@ -510,7 +510,7 @@ pub struct TrivialCast<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_no_associated_item, code = "E0599")]
|
||||
#[diag(hir_typeck_no_associated_item, code = E0599)]
|
||||
pub struct NoAssociatedItem {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -532,7 +532,7 @@ pub struct CandidateTraitNote {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_cannot_cast_to_bool, code = "E0054")]
|
||||
#[diag(hir_typeck_cannot_cast_to_bool, code = E0054)]
|
||||
pub struct CannotCastToBool<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -549,7 +549,7 @@ pub struct CastEnumDrop<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_cast_unknown_pointer, code = "E0641")]
|
||||
#[diag(hir_typeck_cast_unknown_pointer, code = E0641)]
|
||||
pub struct CastUnknownPointer {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -600,7 +600,7 @@ pub enum CannotCastToBoolHelp {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_typeck_ctor_is_private, code = "E0603")]
|
||||
#[diag(hir_typeck_ctor_is_private, code = E0603)]
|
||||
pub struct CtorIsPrivate {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -25,8 +25,8 @@ use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{
|
||||
pluralize, struct_span_code_err, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
ErrorGuaranteed, StashKey,
|
||||
codes::*, pluralize, struct_span_code_err, AddToDiagnostic, Applicability, Diagnostic,
|
||||
DiagnosticBuilder, ErrCode, ErrorGuaranteed, StashKey,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
@ -527,7 +527,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Ty::new_error(tcx, e)
|
||||
}
|
||||
Res::Def(DefKind::Variant, _) => {
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, expr.span, "E0533", "value");
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, expr.span, E0533, "value");
|
||||
Ty::new_error(tcx, e)
|
||||
}
|
||||
_ => self.instantiate_value_path(segs, opt_ty, res, expr.span, expr.hir_id).0,
|
||||
@ -939,7 +939,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
pub(crate) fn check_lhs_assignable(
|
||||
&self,
|
||||
lhs: &'tcx hir::Expr<'tcx>,
|
||||
err_code: &'static str,
|
||||
code: ErrCode,
|
||||
op_span: Span,
|
||||
adjust_err: impl FnOnce(&mut Diagnostic),
|
||||
) {
|
||||
@ -948,7 +948,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
let mut err = self.dcx().struct_span_err(op_span, "invalid left-hand side of assignment");
|
||||
err.code(err_code.into());
|
||||
err.code(code);
|
||||
err.span_label(lhs.span, "cannot assign to this expression");
|
||||
|
||||
self.comes_from_while_condition(lhs.hir_id, |expr| {
|
||||
@ -1244,7 +1244,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
diag.emit();
|
||||
}
|
||||
|
||||
self.check_lhs_assignable(lhs, "E0070", span, |err| {
|
||||
self.check_lhs_assignable(lhs, E0070, span, |err| {
|
||||
if let Some(rhs_ty) = self.typeck_results.borrow().expr_ty_opt(rhs) {
|
||||
suggest_deref_binop(err, rhs_ty);
|
||||
}
|
||||
|
@ -12,7 +12,9 @@ use crate::{
|
||||
use itertools::Itertools;
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{pluralize, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan, StashKey};
|
||||
use rustc_errors::{
|
||||
codes::*, pluralize, Applicability, Diagnostic, ErrCode, ErrorGuaranteed, MultiSpan, StashKey,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
@ -177,7 +179,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
self.register_wf_obligation(fn_input_ty.into(), arg_expr.span, traits::MiscObligation);
|
||||
}
|
||||
|
||||
let mut err_code = "E0061";
|
||||
let mut err_code = E0061;
|
||||
|
||||
// If the arguments should be wrapped in a tuple (ex: closures), unwrap them here
|
||||
let (formal_input_tys, expected_input_tys) = if tuple_arguments == TupleArguments {
|
||||
@ -187,7 +189,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
ty::Tuple(arg_types) => {
|
||||
// Argument length differs
|
||||
if arg_types.len() != provided_args.len() {
|
||||
err_code = "E0057";
|
||||
err_code = E0057;
|
||||
}
|
||||
let expected_input_tys = match expected_input_tys {
|
||||
Some(expected_input_tys) => match expected_input_tys.get(0) {
|
||||
@ -358,7 +360,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
if c_variadic && provided_arg_count < minimum_input_count {
|
||||
err_code = "E0060";
|
||||
err_code = E0060;
|
||||
}
|
||||
|
||||
for arg in provided_args.iter().skip(minimum_input_count) {
|
||||
@ -443,7 +445,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
formal_and_expected_inputs: IndexVec<ExpectedIdx, (Ty<'tcx>, Ty<'tcx>)>,
|
||||
provided_args: IndexVec<ProvidedIdx, &'tcx hir::Expr<'tcx>>,
|
||||
c_variadic: bool,
|
||||
err_code: &str,
|
||||
err_code: ErrCode,
|
||||
fn_def_id: Option<DefId>,
|
||||
call_span: Span,
|
||||
call_expr: &'tcx hir::Expr<'tcx>,
|
||||
|
@ -1,5 +1,5 @@
|
||||
use hir::HirId;
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_errors::{codes::*, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
use rustc_index::Idx;
|
||||
use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
|
||||
|
@ -51,7 +51,7 @@ use crate::expectation::Expectation;
|
||||
use crate::fn_ctxt::LoweredTy;
|
||||
use crate::gather_locals::GatherLocalsVisitor;
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_errors::{struct_span_code_err, ErrorGuaranteed};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, ErrCode, ErrorGuaranteed};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
@ -71,7 +71,7 @@ rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! type_error_struct {
|
||||
($dcx:expr, $span:expr, $typ:expr, $code:ident, $($message:tt)*) => ({
|
||||
($dcx:expr, $span:expr, $typ:expr, $code:expr, $($message:tt)*) => ({
|
||||
let mut err = rustc_errors::struct_span_code_err!($dcx, $span, $code, $($message)*);
|
||||
|
||||
if $typ.references_error() {
|
||||
@ -375,7 +375,7 @@ fn report_unexpected_variant_res(
|
||||
res: Res,
|
||||
qpath: &hir::QPath<'_>,
|
||||
span: Span,
|
||||
err_code: &str,
|
||||
err_code: ErrCode,
|
||||
expected: &str,
|
||||
) -> ErrorGuaranteed {
|
||||
let res_descr = match res {
|
||||
@ -386,9 +386,9 @@ fn report_unexpected_variant_res(
|
||||
let err = tcx
|
||||
.dcx()
|
||||
.struct_span_err(span, format!("expected {expected}, found {res_descr} `{path_str}`"))
|
||||
.with_code(err_code.into());
|
||||
.with_code(err_code);
|
||||
match res {
|
||||
Res::Def(DefKind::Fn | DefKind::AssocFn, _) if err_code == "E0164" => {
|
||||
Res::Def(DefKind::Fn | DefKind::AssocFn, _) if err_code == E0164 => {
|
||||
let patterns_url = "https://doc.rust-lang.org/book/ch18-00-patterns.html";
|
||||
err.with_span_label(span, "`fn` calls are not allowed in patterns")
|
||||
.with_help(format!("for more information, visit {patterns_url}"))
|
||||
|
@ -3,17 +3,16 @@
|
||||
|
||||
// ignore-tidy-filelength
|
||||
|
||||
use crate::errors;
|
||||
use crate::errors::{CandidateTraitNote, NoAssociatedItem};
|
||||
use crate::errors::{self, CandidateTraitNote, NoAssociatedItem};
|
||||
use crate::Expectation;
|
||||
use crate::FnCtxt;
|
||||
use rustc_ast::ast::Mutability;
|
||||
use rustc_attr::parse_confusables;
|
||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_errors::StashKey;
|
||||
use rustc_errors::{
|
||||
pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan,
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
MultiSpan, StashKey,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
|
@ -5,7 +5,7 @@ use super::{has_expected_num_generic_args, FnCtxt};
|
||||
use crate::Expectation;
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::packed::Pu128;
|
||||
use rustc_errors::{struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder};
|
||||
use rustc_hir as hir;
|
||||
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc_infer::traits::ObligationCauseCode;
|
||||
@ -44,7 +44,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
return_ty
|
||||
};
|
||||
|
||||
self.check_lhs_assignable(lhs, "E0067", op.span, |err| {
|
||||
self.check_lhs_assignable(lhs, E0067, op.span, |err| {
|
||||
if let Some(lhs_deref_ty) = self.deref_once_mutably_for_diagnostic(lhs_ty) {
|
||||
if self
|
||||
.lookup_op_method(
|
||||
|
@ -3,8 +3,8 @@ use crate::{errors, FnCtxt, LoweredTy};
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{
|
||||
pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
|
||||
MultiSpan,
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
ErrorGuaranteed, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
@ -576,7 +576,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
if (lhs, rhs).references_error() {
|
||||
err.downgrade_to_delayed_bug();
|
||||
}
|
||||
if self.tcx.sess.teach(&err.get_code().unwrap()) {
|
||||
if self.tcx.sess.teach(err.get_code().unwrap()) {
|
||||
err.note(
|
||||
"In a match expression, only numbers and characters can be matched \
|
||||
against a range. This is because the compiler checks that the range \
|
||||
@ -847,7 +847,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
type_str
|
||||
);
|
||||
err.span_label(span, format!("type `{type_str}` cannot be dereferenced"));
|
||||
if self.tcx.sess.teach(&err.get_code().unwrap()) {
|
||||
if self.tcx.sess.teach(err.get_code().unwrap()) {
|
||||
err.note(CANNOT_IMPLICITLY_DEREF_POINTER_TRAIT_OBJ);
|
||||
}
|
||||
return Err(err.emit());
|
||||
@ -907,7 +907,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
Res::Def(DefKind::AssocFn | DefKind::Ctor(_, CtorKind::Fn) | DefKind::Variant, _) => {
|
||||
let expected = "unit struct, unit variant or constant";
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, "E0533", expected);
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, E0533, expected);
|
||||
return Ty::new_error(tcx, e);
|
||||
}
|
||||
Res::SelfCtor(..)
|
||||
@ -1061,7 +1061,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
};
|
||||
let report_unexpected_res = |res: Res| {
|
||||
let expected = "tuple struct or tuple variant";
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, "E0164", expected);
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, E0164, expected);
|
||||
on_error(e);
|
||||
e
|
||||
};
|
||||
@ -1669,7 +1669,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
if tcx.sess.teach(&err.get_code().unwrap()) {
|
||||
if tcx.sess.teach(err.get_code().unwrap()) {
|
||||
err.note(
|
||||
"This error indicates that a struct pattern attempted to \
|
||||
extract a nonexistent field from a struct. Struct fields \
|
||||
|
@ -1,7 +1,7 @@
|
||||
use hir::GenericParamKind;
|
||||
use rustc_errors::{
|
||||
AddToDiagnostic, Applicability, Diagnostic, DiagnosticMessage, DiagnosticStyledString,
|
||||
IntoDiagnosticArg, MultiSpan, SubdiagnosticMessage,
|
||||
codes::*, AddToDiagnostic, Applicability, Diagnostic, DiagnosticMessage,
|
||||
DiagnosticStyledString, IntoDiagnosticArg, MultiSpan, SubdiagnosticMessage,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::FnRetTy;
|
||||
@ -33,7 +33,7 @@ pub struct OpaqueHiddenTypeDiag {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_type_annotations_needed, code = "E0282")]
|
||||
#[diag(infer_type_annotations_needed, code = E0282)]
|
||||
pub struct AnnotationRequired<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -51,7 +51,7 @@ pub struct AnnotationRequired<'a> {
|
||||
|
||||
// Copy of `AnnotationRequired` for E0283
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_type_annotations_needed, code = "E0283")]
|
||||
#[diag(infer_type_annotations_needed, code = E0283)]
|
||||
pub struct AmbiguousImpl<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -69,7 +69,7 @@ pub struct AmbiguousImpl<'a> {
|
||||
|
||||
// Copy of `AnnotationRequired` for E0284
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_type_annotations_needed, code = "E0284")]
|
||||
#[diag(infer_type_annotations_needed, code = E0284)]
|
||||
pub struct AmbiguousReturn<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -421,7 +421,7 @@ impl AddToDiagnostic for AddLifetimeParamsSuggestion<'_> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_lifetime_mismatch, code = "E0623")]
|
||||
#[diag(infer_lifetime_mismatch, code = E0623)]
|
||||
pub struct LifetimeMismatch<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -495,7 +495,7 @@ pub struct MismatchedStaticLifetime<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum ExplicitLifetimeRequired<'a> {
|
||||
#[diag(infer_explicit_lifetime_required_with_ident, code = "E0621")]
|
||||
#[diag(infer_explicit_lifetime_required_with_ident, code = E0621)]
|
||||
WithIdent {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -511,7 +511,7 @@ pub enum ExplicitLifetimeRequired<'a> {
|
||||
#[skip_arg]
|
||||
new_ty: Ty<'a>,
|
||||
},
|
||||
#[diag(infer_explicit_lifetime_required_with_param_type, code = "E0621")]
|
||||
#[diag(infer_explicit_lifetime_required_with_param_type, code = E0621)]
|
||||
WithParamType {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -819,7 +819,7 @@ impl AddToDiagnostic for DynTraitConstraintSuggestion {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_but_calling_introduces, code = "E0772")]
|
||||
#[diag(infer_but_calling_introduces, code = E0772)]
|
||||
pub struct ButCallingIntroduces {
|
||||
#[label(infer_label1)]
|
||||
pub param_ty_span: Span,
|
||||
@ -871,14 +871,14 @@ impl AddToDiagnostic for MoreTargeted {
|
||||
where
|
||||
F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
|
||||
{
|
||||
diag.code(rustc_errors::error_code!(E0772));
|
||||
diag.code(E0772);
|
||||
diag.primary_message(fluent::infer_more_targeted);
|
||||
diag.arg("ident", self.ident);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_but_needs_to_satisfy, code = "E0759")]
|
||||
#[diag(infer_but_needs_to_satisfy, code = E0759)]
|
||||
pub struct ButNeedsToSatisfy {
|
||||
#[primary_span]
|
||||
pub sp: Span,
|
||||
@ -904,7 +904,7 @@ pub struct ButNeedsToSatisfy {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_outlives_content, code = "E0312")]
|
||||
#[diag(infer_outlives_content, code = E0312)]
|
||||
pub struct OutlivesContent<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -913,7 +913,7 @@ pub struct OutlivesContent<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_outlives_bound, code = "E0476")]
|
||||
#[diag(infer_outlives_bound, code = E0476)]
|
||||
pub struct OutlivesBound<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -922,7 +922,7 @@ pub struct OutlivesBound<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_fulfill_req_lifetime, code = "E0477")]
|
||||
#[diag(infer_fulfill_req_lifetime, code = E0477)]
|
||||
pub struct FulfillReqLifetime<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -932,7 +932,7 @@ pub struct FulfillReqLifetime<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_lf_bound_not_satisfied, code = "E0478")]
|
||||
#[diag(infer_lf_bound_not_satisfied, code = E0478)]
|
||||
pub struct LfBoundNotSatisfied<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -941,7 +941,7 @@ pub struct LfBoundNotSatisfied<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_ref_longer_than_data, code = "E0491")]
|
||||
#[diag(infer_ref_longer_than_data, code = E0491)]
|
||||
pub struct RefLongerThanData<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1117,7 +1117,7 @@ pub enum PlaceholderRelationLfNotSatisfied {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(infer_opaque_captures_lifetime, code = "E0700")]
|
||||
#[diag(infer_opaque_captures_lifetime, code = E0700)]
|
||||
pub struct OpaqueCapturesLifetime<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1378,73 +1378,73 @@ pub enum TypeErrorAdditionalDiags {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum ObligationCauseFailureCode {
|
||||
#[diag(infer_oc_method_compat, code = "E0308")]
|
||||
#[diag(infer_oc_method_compat, code = E0308)]
|
||||
MethodCompat {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_type_compat, code = "E0308")]
|
||||
#[diag(infer_oc_type_compat, code = E0308)]
|
||||
TypeCompat {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_const_compat, code = "E0308")]
|
||||
#[diag(infer_oc_const_compat, code = E0308)]
|
||||
ConstCompat {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_try_compat, code = "E0308")]
|
||||
#[diag(infer_oc_try_compat, code = E0308)]
|
||||
TryCompat {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_match_compat, code = "E0308")]
|
||||
#[diag(infer_oc_match_compat, code = E0308)]
|
||||
MatchCompat {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_if_else_different, code = "E0308")]
|
||||
#[diag(infer_oc_if_else_different, code = E0308)]
|
||||
IfElseDifferent {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_no_else, code = "E0317")]
|
||||
#[diag(infer_oc_no_else, code = E0317)]
|
||||
NoElse {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(infer_oc_no_diverge, code = "E0308")]
|
||||
#[diag(infer_oc_no_diverge, code = E0308)]
|
||||
NoDiverge {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_fn_main_correct_type, code = "E0580")]
|
||||
#[diag(infer_oc_fn_main_correct_type, code = E0580)]
|
||||
FnMainCorrectType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(infer_oc_fn_start_correct_type, code = "E0308")]
|
||||
#[diag(infer_oc_fn_start_correct_type, code = E0308)]
|
||||
FnStartCorrectType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_fn_lang_correct_type, code = "E0308")]
|
||||
#[diag(infer_oc_fn_lang_correct_type, code = E0308)]
|
||||
FnLangCorrectType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
@ -1452,33 +1452,33 @@ pub enum ObligationCauseFailureCode {
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
lang_item_name: Symbol,
|
||||
},
|
||||
#[diag(infer_oc_intrinsic_correct_type, code = "E0308")]
|
||||
#[diag(infer_oc_intrinsic_correct_type, code = E0308)]
|
||||
IntrinsicCorrectType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_method_correct_type, code = "E0308")]
|
||||
#[diag(infer_oc_method_correct_type, code = E0308)]
|
||||
MethodCorrectType {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_closure_selfref, code = "E0644")]
|
||||
#[diag(infer_oc_closure_selfref, code = E0644)]
|
||||
ClosureSelfref {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(infer_oc_cant_coerce, code = "E0308")]
|
||||
#[diag(infer_oc_cant_coerce, code = E0308)]
|
||||
CantCoerce {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
#[subdiagnostic]
|
||||
subdiags: Vec<TypeErrorAdditionalDiags>,
|
||||
},
|
||||
#[diag(infer_oc_generic, code = "E0308")]
|
||||
#[diag(infer_oc_generic, code = E0308)]
|
||||
Generic {
|
||||
#[primary_span]
|
||||
span: Span,
|
||||
|
@ -60,7 +60,7 @@ use crate::traits::{
|
||||
|
||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
use rustc_errors::{
|
||||
error_code, pluralize, struct_span_code_err, Applicability, DiagCtxt, Diagnostic,
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, DiagCtxt, Diagnostic,
|
||||
DiagnosticBuilder, DiagnosticStyledString, ErrorGuaranteed, IntoDiagnosticArg,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
@ -2362,9 +2362,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
.dcx()
|
||||
.struct_span_err(span, format!("{labeled_user_string} may not live long enough"));
|
||||
err.code(match sub.kind() {
|
||||
ty::ReEarlyParam(_) | ty::ReLateParam(_) if sub.has_name() => error_code!(E0309),
|
||||
ty::ReStatic => error_code!(E0310),
|
||||
_ => error_code!(E0311),
|
||||
ty::ReEarlyParam(_) | ty::ReLateParam(_) if sub.has_name() => E0309,
|
||||
ty::ReStatic => E0310,
|
||||
_ => E0311,
|
||||
});
|
||||
|
||||
'_explain: {
|
||||
|
@ -5,7 +5,7 @@ use crate::errors::{
|
||||
use crate::infer::error_reporting::TypeErrCtxt;
|
||||
use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use crate::infer::InferCtxt;
|
||||
use rustc_errors::{DiagnosticBuilder, IntoDiagnosticArg};
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder, ErrCode, IntoDiagnosticArg};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Namespace};
|
||||
@ -43,12 +43,12 @@ pub enum TypeAnnotationNeeded {
|
||||
E0284,
|
||||
}
|
||||
|
||||
impl Into<String> for TypeAnnotationNeeded {
|
||||
fn into(self) -> String {
|
||||
impl Into<ErrCode> for TypeAnnotationNeeded {
|
||||
fn into(self) -> ErrCode {
|
||||
match self {
|
||||
Self::E0282 => rustc_errors::error_code!(E0282),
|
||||
Self::E0283 => rustc_errors::error_code!(E0283),
|
||||
Self::E0284 => rustc_errors::error_code!(E0284),
|
||||
Self::E0282 => E0282,
|
||||
Self::E0283 => E0283,
|
||||
Self::E0284 => E0284,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
diag.help("type parameters must be constrained to match other types");
|
||||
if tcx.sess.teach(&diag.get_code().unwrap()) {
|
||||
if tcx.sess.teach(diag.get_code().unwrap()) {
|
||||
diag.help(
|
||||
"given a type parameter `T` and a method `foo`:
|
||||
```
|
||||
@ -678,7 +678,7 @@ impl<T> Trait<T> for X {
|
||||
https://doc.rust-lang.org/book/ch19-03-advanced-traits.html",
|
||||
);
|
||||
}
|
||||
if tcx.sess.teach(&diag.get_code().unwrap()) {
|
||||
if tcx.sess.teach(diag.get_code().unwrap()) {
|
||||
diag.help(
|
||||
"given an associated type `T` and a method `foo`:
|
||||
```
|
||||
|
@ -2,7 +2,7 @@ use super::ObjectSafetyViolation;
|
||||
|
||||
use crate::infer::InferCtxt;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{struct_span_code_err, Applicability, DiagnosticBuilder, MultiSpan};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::Map;
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{AddToDiagnostic, Diagnostic, SubdiagnosticMessage};
|
||||
use rustc_errors::{codes::*, AddToDiagnostic, Diagnostic, SubdiagnosticMessage};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_session::lint::Level;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(lint_overruled_attribute, code = "E0453")]
|
||||
#[diag(lint_overruled_attribute, code = E0453)]
|
||||
pub struct OverruledAttribute<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -48,7 +48,7 @@ impl AddToDiagnostic for OverruledAttributeSub {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(lint_malformed_attribute, code = "E0452")]
|
||||
#[diag(lint_malformed_attribute, code = E0452)]
|
||||
pub struct MalformedAttribute {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -67,7 +67,7 @@ pub enum MalformedAttributeSub {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(lint_unknown_tool_in_scoped_lint, code = "E0710")]
|
||||
#[diag(lint_unknown_tool_in_scoped_lint, code = E0710)]
|
||||
pub struct UnknownToolInScopedLint {
|
||||
#[primary_span]
|
||||
pub span: Option<Span>,
|
||||
@ -78,7 +78,7 @@ pub struct UnknownToolInScopedLint {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(lint_builtin_ellipsis_inclusive_range_patterns, code = "E0783")]
|
||||
#[diag(lint_builtin_ellipsis_inclusive_range_patterns, code = E0783)]
|
||||
pub struct BuiltinEllipsisInclusiveRangePatterns {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -95,13 +95,13 @@ pub struct RequestedLevel<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(lint_unsupported_group, code = "E0602")]
|
||||
#[diag(lint_unsupported_group, code = E0602)]
|
||||
pub struct UnsupportedGroup {
|
||||
pub lint_group: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(lint_check_name_unknown_tool, code = "E0602")]
|
||||
#[diag(lint_check_name_unknown_tool, code = E0602)]
|
||||
pub struct CheckNameUnknownTool<'a> {
|
||||
pub tool_name: Symbol,
|
||||
#[subdiagnostic]
|
||||
|
@ -5,8 +5,8 @@ use std::num::NonZeroU32;
|
||||
use crate::errors::RequestedLevel;
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{
|
||||
AddToDiagnostic, Applicability, DecorateLint, Diagnostic, DiagnosticBuilder, DiagnosticMessage,
|
||||
DiagnosticStyledString, SubdiagnosticMessage, SuggestionStyle,
|
||||
codes::*, AddToDiagnostic, Applicability, DecorateLint, Diagnostic, DiagnosticBuilder,
|
||||
DiagnosticMessage, DiagnosticStyledString, SubdiagnosticMessage, SuggestionStyle,
|
||||
};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{LintDiagnostic, Subdiagnostic};
|
||||
@ -1065,7 +1065,7 @@ pub enum UnknownLintSuggestion {
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_unknown_lint, code = "E0602")]
|
||||
#[diag(lint_unknown_lint, code = E0602)]
|
||||
pub struct UnknownLintFromCommandLine<'a> {
|
||||
pub name: String,
|
||||
#[subdiagnostic]
|
||||
|
@ -209,9 +209,9 @@ impl DiagnosticDeriveVariantBuilder {
|
||||
if path.is_ident("code") {
|
||||
self.code.set_once((), path.span().unwrap());
|
||||
|
||||
let code = nested.parse::<syn::LitStr>()?;
|
||||
let code = nested.parse::<syn::Expr>()?;
|
||||
tokens.extend(quote! {
|
||||
diag.code(#code.to_string());
|
||||
diag.code(#code);
|
||||
});
|
||||
} else {
|
||||
span_err(path.span().unwrap(), "unknown argument")
|
||||
|
@ -20,7 +20,7 @@ use synstructure::Structure;
|
||||
/// # extern crate rust_middle;
|
||||
/// # use rustc_middle::ty::Ty;
|
||||
/// #[derive(Diagnostic)]
|
||||
/// #[diag(borrowck_move_out_of_borrow, code = "E0505")]
|
||||
/// #[diag(borrowck_move_out_of_borrow, code = E0505)]
|
||||
/// pub struct MoveOutOfBorrowError<'tcx> {
|
||||
/// pub name: Ident,
|
||||
/// pub ty: Ty<'tcx>,
|
||||
|
@ -4,7 +4,7 @@ use std::{
|
||||
};
|
||||
|
||||
use rustc_errors::{
|
||||
error_code, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
codes::*, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_session::config;
|
||||
@ -122,7 +122,7 @@ pub struct WasmImportForm {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_empty_link_name, code = "E0454")]
|
||||
#[diag(metadata_empty_link_name, code = E0454)]
|
||||
pub struct EmptyLinkName {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -130,21 +130,21 @@ pub struct EmptyLinkName {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_link_framework_apple, code = "E0455")]
|
||||
#[diag(metadata_link_framework_apple, code = E0455)]
|
||||
pub struct LinkFrameworkApple {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_framework_only_windows, code = "E0455")]
|
||||
#[diag(metadata_framework_only_windows, code = E0455)]
|
||||
pub struct FrameworkOnlyWindows {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_unknown_link_kind, code = "E0458")]
|
||||
#[diag(metadata_unknown_link_kind, code = E0458)]
|
||||
pub struct UnknownLinkKind<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -239,7 +239,7 @@ pub struct IncompatibleWasmLink {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_link_requires_name, code = "E0459")]
|
||||
#[diag(metadata_link_requires_name, code = E0459)]
|
||||
pub struct LinkRequiresName {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -502,7 +502,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for MultipleCandidates {
|
||||
let mut diag = DiagnosticBuilder::new(dcx, level, fluent::metadata_multiple_candidates);
|
||||
diag.arg("crate_name", self.crate_name);
|
||||
diag.arg("flavor", self.flavor);
|
||||
diag.code(error_code!(E0464));
|
||||
diag.code(E0464);
|
||||
diag.span(self.span);
|
||||
for (i, candidate) in self.candidates.iter().enumerate() {
|
||||
diag.note(format!("candidate #{}: {}", i + 1, candidate.display()));
|
||||
@ -512,7 +512,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for MultipleCandidates {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_symbol_conflicts_current, code = "E0519")]
|
||||
#[diag(metadata_symbol_conflicts_current, code = E0519)]
|
||||
pub struct SymbolConflictsCurrent {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -537,7 +537,7 @@ pub struct DlError {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_newer_crate_version, code = "E0460")]
|
||||
#[diag(metadata_newer_crate_version, code = E0460)]
|
||||
#[note]
|
||||
#[note(metadata_found_crate_versions)]
|
||||
pub struct NewerCrateVersion {
|
||||
@ -549,7 +549,7 @@ pub struct NewerCrateVersion {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_no_crate_with_triple, code = "E0461")]
|
||||
#[diag(metadata_no_crate_with_triple, code = E0461)]
|
||||
#[note(metadata_found_crate_versions)]
|
||||
pub struct NoCrateWithTriple<'a> {
|
||||
#[primary_span]
|
||||
@ -561,7 +561,7 @@ pub struct NoCrateWithTriple<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_found_staticlib, code = "E0462")]
|
||||
#[diag(metadata_found_staticlib, code = E0462)]
|
||||
#[note(metadata_found_crate_versions)]
|
||||
#[help]
|
||||
pub struct FoundStaticlib {
|
||||
@ -573,7 +573,7 @@ pub struct FoundStaticlib {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_incompatible_rustc, code = "E0514")]
|
||||
#[diag(metadata_incompatible_rustc, code = E0514)]
|
||||
#[note(metadata_found_crate_versions)]
|
||||
#[help]
|
||||
pub struct IncompatibleRustc {
|
||||
@ -598,7 +598,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for InvalidMetadataFiles {
|
||||
let mut diag = DiagnosticBuilder::new(dcx, level, fluent::metadata_invalid_meta_files);
|
||||
diag.arg("crate_name", self.crate_name);
|
||||
diag.arg("add_info", self.add_info);
|
||||
diag.code(error_code!(E0786));
|
||||
diag.code(E0786);
|
||||
diag.span(self.span);
|
||||
for crate_rejection in self.crate_rejections {
|
||||
diag.note(crate_rejection);
|
||||
@ -627,7 +627,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for CannotFindCrate {
|
||||
diag.arg("current_crate", self.current_crate);
|
||||
diag.arg("add_info", self.add_info);
|
||||
diag.arg("locator_triple", self.locator_triple.triple());
|
||||
diag.code(error_code!(E0463));
|
||||
diag.code(E0463);
|
||||
diag.span(self.span);
|
||||
if (self.crate_name == sym::std || self.crate_name == sym::core)
|
||||
&& self.locator_triple != TargetTriple::from_triple(config::host_triple())
|
||||
|
@ -1,14 +1,14 @@
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
|
||||
use rustc_errors::{DiagnosticArgValue, DiagnosticMessage};
|
||||
use rustc_errors::{codes::*, DiagnosticArgValue, DiagnosticMessage};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use crate::ty::Ty;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(middle_drop_check_overflow, code = "E0320")]
|
||||
#[diag(middle_drop_check_overflow, code = E0320)]
|
||||
#[note]
|
||||
pub struct DropCheckOverflow<'tcx> {
|
||||
#[primary_span]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::dep_graph::dep_kinds;
|
||||
use crate::query::plumbing::CyclePlaceholder;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{pluralize, struct_span_code_err, Applicability, MultiSpan};
|
||||
use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_middle::ty::Representability;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::DiagnosticArgValue;
|
||||
use rustc_errors::{
|
||||
error_code, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
|
||||
codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
|
||||
IntoDiagnostic, Level, MultiSpan, SubdiagnosticMessage,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
@ -138,7 +138,7 @@ pub struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_call_to_unsafe_fn_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_call_to_unsafe_fn_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct CallToUnsafeFunctionRequiresUnsafe<'a> {
|
||||
#[primary_span]
|
||||
@ -150,7 +150,7 @@ pub struct CallToUnsafeFunctionRequiresUnsafe<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_call_to_unsafe_fn_requires_unsafe_nameless, code = "E0133")]
|
||||
#[diag(mir_build_call_to_unsafe_fn_requires_unsafe_nameless, code = E0133)]
|
||||
#[note]
|
||||
pub struct CallToUnsafeFunctionRequiresUnsafeNameless {
|
||||
#[primary_span]
|
||||
@ -161,7 +161,7 @@ pub struct CallToUnsafeFunctionRequiresUnsafeNameless {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_call_to_unsafe_fn_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = "E0133")]
|
||||
#[diag(mir_build_call_to_unsafe_fn_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
|
||||
#[note]
|
||||
pub struct CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed<'a> {
|
||||
#[primary_span]
|
||||
@ -175,7 +175,7 @@ pub struct CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed<'a> {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(
|
||||
mir_build_call_to_unsafe_fn_requires_unsafe_nameless_unsafe_op_in_unsafe_fn_allowed,
|
||||
code = "E0133"
|
||||
code = E0133
|
||||
)]
|
||||
#[note]
|
||||
pub struct CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed {
|
||||
@ -187,7 +187,7 @@ pub struct CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_inline_assembly_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_inline_assembly_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct UseOfInlineAssemblyRequiresUnsafe {
|
||||
#[primary_span]
|
||||
@ -198,7 +198,7 @@ pub struct UseOfInlineAssemblyRequiresUnsafe {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_inline_assembly_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = "E0133")]
|
||||
#[diag(mir_build_inline_assembly_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
|
||||
#[note]
|
||||
pub struct UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
#[primary_span]
|
||||
@ -209,7 +209,7 @@ pub struct UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_initializing_type_with_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_initializing_type_with_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct InitializingTypeWithRequiresUnsafe {
|
||||
#[primary_span]
|
||||
@ -222,7 +222,7 @@ pub struct InitializingTypeWithRequiresUnsafe {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(
|
||||
mir_build_initializing_type_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed,
|
||||
code = "E0133"
|
||||
code = E0133
|
||||
)]
|
||||
#[note]
|
||||
pub struct InitializingTypeWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
@ -234,7 +234,7 @@ pub struct InitializingTypeWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_mutable_static_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_mutable_static_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct UseOfMutableStaticRequiresUnsafe {
|
||||
#[primary_span]
|
||||
@ -245,7 +245,7 @@ pub struct UseOfMutableStaticRequiresUnsafe {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_mutable_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = "E0133")]
|
||||
#[diag(mir_build_mutable_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
|
||||
#[note]
|
||||
pub struct UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
#[primary_span]
|
||||
@ -256,7 +256,7 @@ pub struct UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_extern_static_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_extern_static_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct UseOfExternStaticRequiresUnsafe {
|
||||
#[primary_span]
|
||||
@ -267,7 +267,7 @@ pub struct UseOfExternStaticRequiresUnsafe {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_extern_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = "E0133")]
|
||||
#[diag(mir_build_extern_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
|
||||
#[note]
|
||||
pub struct UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
#[primary_span]
|
||||
@ -278,7 +278,7 @@ pub struct UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_deref_raw_pointer_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_deref_raw_pointer_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct DerefOfRawPointerRequiresUnsafe {
|
||||
#[primary_span]
|
||||
@ -289,7 +289,7 @@ pub struct DerefOfRawPointerRequiresUnsafe {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = "E0133")]
|
||||
#[diag(mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
|
||||
#[note]
|
||||
pub struct DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
#[primary_span]
|
||||
@ -300,7 +300,7 @@ pub struct DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_union_field_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_union_field_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct AccessToUnionFieldRequiresUnsafe {
|
||||
#[primary_span]
|
||||
@ -311,7 +311,7 @@ pub struct AccessToUnionFieldRequiresUnsafe {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_union_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = "E0133")]
|
||||
#[diag(mir_build_union_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
|
||||
#[note]
|
||||
pub struct AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
#[primary_span]
|
||||
@ -322,7 +322,7 @@ pub struct AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_mutation_of_layout_constrained_field_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_mutation_of_layout_constrained_field_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct MutationOfLayoutConstrainedFieldRequiresUnsafe {
|
||||
#[primary_span]
|
||||
@ -335,7 +335,7 @@ pub struct MutationOfLayoutConstrainedFieldRequiresUnsafe {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(
|
||||
mir_build_mutation_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed,
|
||||
code = "E0133"
|
||||
code = E0133
|
||||
)]
|
||||
#[note]
|
||||
pub struct MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
@ -347,7 +347,7 @@ pub struct MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllow
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_borrow_of_layout_constrained_field_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_borrow_of_layout_constrained_field_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
pub struct BorrowOfLayoutConstrainedFieldRequiresUnsafe {
|
||||
#[primary_span]
|
||||
@ -360,7 +360,7 @@ pub struct BorrowOfLayoutConstrainedFieldRequiresUnsafe {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(
|
||||
mir_build_borrow_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed,
|
||||
code = "E0133"
|
||||
code = E0133
|
||||
)]
|
||||
#[note]
|
||||
pub struct BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
|
||||
@ -372,7 +372,7 @@ pub struct BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_call_to_fn_with_requires_unsafe, code = "E0133")]
|
||||
#[diag(mir_build_call_to_fn_with_requires_unsafe, code = E0133)]
|
||||
#[help]
|
||||
pub struct CallToFunctionWithRequiresUnsafe<'a> {
|
||||
#[primary_span]
|
||||
@ -390,7 +390,7 @@ pub struct CallToFunctionWithRequiresUnsafe<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_call_to_fn_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = "E0133")]
|
||||
#[diag(mir_build_call_to_fn_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
|
||||
#[help]
|
||||
pub struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed<'a> {
|
||||
#[primary_span]
|
||||
@ -468,7 +468,7 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> {
|
||||
fluent::mir_build_non_exhaustive_patterns_type_not_empty,
|
||||
);
|
||||
diag.span(self.span);
|
||||
diag.code(error_code!(E0004));
|
||||
diag.code(E0004);
|
||||
let peeled_ty = self.ty.peel_refs();
|
||||
diag.arg("ty", self.ty);
|
||||
diag.arg("peeled_ty", peeled_ty);
|
||||
@ -539,28 +539,28 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> {
|
||||
pub struct NonExhaustiveMatchAllArmsGuarded;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_static_in_pattern, code = "E0158")]
|
||||
#[diag(mir_build_static_in_pattern, code = E0158)]
|
||||
pub struct StaticInPattern {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_assoc_const_in_pattern, code = "E0158")]
|
||||
#[diag(mir_build_assoc_const_in_pattern, code = E0158)]
|
||||
pub struct AssocConstInPattern {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_const_param_in_pattern, code = "E0158")]
|
||||
#[diag(mir_build_const_param_in_pattern, code = E0158)]
|
||||
pub struct ConstParamInPattern {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_non_const_path, code = "E0080")]
|
||||
#[diag(mir_build_non_const_path, code = E0080)]
|
||||
pub struct NonConstPath {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -590,7 +590,7 @@ pub struct CouldNotEvalConstPattern {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_lower_range_bound_must_be_less_than_or_equal_to_upper, code = "E0030")]
|
||||
#[diag(mir_build_lower_range_bound_must_be_less_than_or_equal_to_upper, code = E0030)]
|
||||
pub struct LowerRangeBoundMustBeLessThanOrEqualToUpper {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -611,7 +611,7 @@ pub struct LiteralOutOfRange<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_lower_range_bound_must_be_less_than_upper, code = "E0579")]
|
||||
#[diag(mir_build_lower_range_bound_must_be_less_than_upper, code = E0579)]
|
||||
pub struct LowerRangeBoundMustBeLessThanUpper {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -634,7 +634,7 @@ pub struct TrailingIrrefutableLetPatterns {
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(mir_build_bindings_with_variant_name, code = "E0170")]
|
||||
#[diag(mir_build_bindings_with_variant_name, code = E0170)]
|
||||
pub struct BindingsWithVariantName {
|
||||
#[suggestion(code = "{ty_path}::{name}", applicability = "machine-applicable")]
|
||||
pub suggestion: Option<Span>,
|
||||
@ -821,7 +821,7 @@ pub struct NonPartialEqMatch<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_build_pattern_not_covered, code = "E0005")]
|
||||
#[diag(mir_build_pattern_not_covered, code = E0005)]
|
||||
pub(crate) struct PatternNotCovered<'s, 'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -11,7 +11,7 @@ use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{
|
||||
struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan,
|
||||
codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::*;
|
||||
|
@ -8,7 +8,7 @@ pub(crate) use self::check_match::check_match;
|
||||
use crate::errors::*;
|
||||
use crate::thir::util::UserAnnotatedTyHelpers;
|
||||
|
||||
use rustc_errors::error_code;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Res};
|
||||
use rustc_hir::pat_util::EnumerateAndAdjustIterator;
|
||||
@ -209,7 +209,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||
RangeEnd::Included => {
|
||||
self.tcx.dcx().emit_err(LowerRangeBoundMustBeLessThanOrEqualToUpper {
|
||||
span,
|
||||
teach: self.tcx.sess.teach(&error_code!(E0030)).then_some(()),
|
||||
teach: self.tcx.sess.teach(E0030).then_some(()),
|
||||
})
|
||||
}
|
||||
RangeEnd::Excluded => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use rustc_errors::{
|
||||
Applicability, DecorateLint, DiagCtxt, DiagnosticArgValue, DiagnosticBuilder,
|
||||
codes::*, Applicability, DecorateLint, DiagCtxt, DiagnosticArgValue, DiagnosticBuilder,
|
||||
DiagnosticMessage, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
@ -33,7 +33,7 @@ pub(crate) enum ConstMutate {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(mir_transform_unaligned_packed_ref, code = "E0793")]
|
||||
#[diag(mir_transform_unaligned_packed_ref, code = E0793)]
|
||||
#[note]
|
||||
#[note(mir_transform_note_ub)]
|
||||
#[help]
|
||||
@ -66,7 +66,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for RequiresUnsafe {
|
||||
#[track_caller]
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
let mut diag = DiagnosticBuilder::new(dcx, level, fluent::mir_transform_requires_unsafe);
|
||||
diag.code("E0133".to_string());
|
||||
diag.code(E0133);
|
||||
diag.span(self.span);
|
||||
diag.span_label(self.span, self.details.label());
|
||||
let desc = dcx.eagerly_translate_to_string(self.details.label(), [].into_iter());
|
||||
|
@ -3,7 +3,7 @@ use std::borrow::Cow;
|
||||
use rustc_ast::token::Token;
|
||||
use rustc_ast::{Path, Visibility};
|
||||
use rustc_errors::{
|
||||
AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, IntoDiagnostic, Level,
|
||||
codes::*, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, IntoDiagnostic, Level,
|
||||
SubdiagnosticMessage,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
@ -25,7 +25,7 @@ pub(crate) struct AmbiguousPlus {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_maybe_recover_from_bad_type_plus, code = "E0178")]
|
||||
#[diag(parse_maybe_recover_from_bad_type_plus, code = E0178)]
|
||||
pub(crate) struct BadTypePlus {
|
||||
pub ty: String,
|
||||
#[primary_span]
|
||||
@ -807,7 +807,7 @@ pub(crate) struct InclusiveRangeMatchArrow {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_inclusive_range_no_end, code = "E0586")]
|
||||
#[diag(parse_inclusive_range_no_end, code = E0586)]
|
||||
#[note]
|
||||
pub(crate) struct InclusiveRangeNoEnd {
|
||||
#[primary_span]
|
||||
@ -901,7 +901,7 @@ pub(crate) struct MismatchedClosingDelimiter {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_incorrect_visibility_restriction, code = "E0704")]
|
||||
#[diag(parse_incorrect_visibility_restriction, code = E0704)]
|
||||
#[help]
|
||||
pub(crate) struct IncorrectVisibilityRestriction {
|
||||
#[primary_span]
|
||||
@ -925,7 +925,7 @@ pub(crate) struct ExpectedStatementAfterOuterAttr {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_doc_comment_does_not_document_anything, code = "E0585")]
|
||||
#[diag(parse_doc_comment_does_not_document_anything, code = E0585)]
|
||||
#[help]
|
||||
pub(crate) struct DocCommentDoesNotDocumentAnything {
|
||||
#[primary_span]
|
||||
@ -1357,7 +1357,7 @@ pub(crate) struct AttributeOnParamType {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_pattern_method_param_without_body, code = "E0642")]
|
||||
#[diag(parse_pattern_method_param_without_body, code = E0642)]
|
||||
pub(crate) struct PatternMethodParamWithoutBody {
|
||||
#[primary_span]
|
||||
#[suggestion(code = "_", applicability = "machine-applicable")]
|
||||
@ -1565,7 +1565,7 @@ pub(crate) struct WhereClauseBeforeTupleStructBodySugg {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_async_fn_in_2015, code = "E0670")]
|
||||
#[diag(parse_async_fn_in_2015, code = E0670)]
|
||||
pub(crate) struct AsyncFnIn2015 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1929,7 +1929,7 @@ pub struct CrDocComment {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_no_digits_literal, code = "E0768")]
|
||||
#[diag(parse_no_digits_literal, code = E0768)]
|
||||
pub struct NoDigitsLiteral {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -2499,7 +2499,7 @@ pub(crate) struct FnPointerCannotBeAsync {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_nested_c_variadic_type, code = "E0743")]
|
||||
#[diag(parse_nested_c_variadic_type, code = E0743)]
|
||||
pub(crate) struct NestedCVariadicType {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -7,7 +7,7 @@ use rustc_ast::ast::{self, AttrStyle};
|
||||
use rustc_ast::token::{self, CommentKind, Delimiter, Token, TokenKind};
|
||||
use rustc_ast::tokenstream::TokenStream;
|
||||
use rustc_ast::util::unicode::contains_text_flow_control_chars;
|
||||
use rustc_errors::{error_code, Applicability, DiagCtxt, DiagnosticBuilder, StashKey};
|
||||
use rustc_errors::{codes::*, Applicability, DiagCtxt, DiagnosticBuilder, StashKey};
|
||||
use rustc_lexer::unescape::{self, EscapeError, Mode};
|
||||
use rustc_lexer::{Base, DocStyle, RawStrError};
|
||||
use rustc_lexer::{Cursor, LiteralKind};
|
||||
@ -397,7 +397,7 @@ impl<'sess, 'src> StringReader<'sess, 'src> {
|
||||
if !terminated {
|
||||
self.dcx()
|
||||
.struct_span_fatal(self.mk_sp(start, end), "unterminated character literal")
|
||||
.with_code(error_code!(E0762))
|
||||
.with_code(E0762)
|
||||
.emit()
|
||||
}
|
||||
self.cook_unicode(token::Char, Mode::Char, start, end, 1, 1) // ' '
|
||||
@ -409,7 +409,7 @@ impl<'sess, 'src> StringReader<'sess, 'src> {
|
||||
self.mk_sp(start + BytePos(1), end),
|
||||
"unterminated byte constant",
|
||||
)
|
||||
.with_code(error_code!(E0763))
|
||||
.with_code(E0763)
|
||||
.emit()
|
||||
}
|
||||
self.cook_unicode(token::Byte, Mode::Byte, start, end, 2, 1) // b' '
|
||||
@ -421,7 +421,7 @@ impl<'sess, 'src> StringReader<'sess, 'src> {
|
||||
self.mk_sp(start, end),
|
||||
"unterminated double quote string",
|
||||
)
|
||||
.with_code(error_code!(E0765))
|
||||
.with_code(E0765)
|
||||
.emit()
|
||||
}
|
||||
self.cook_unicode(token::Str, Mode::Str, start, end, 1, 1) // " "
|
||||
@ -433,7 +433,7 @@ impl<'sess, 'src> StringReader<'sess, 'src> {
|
||||
self.mk_sp(start + BytePos(1), end),
|
||||
"unterminated double quote byte string",
|
||||
)
|
||||
.with_code(error_code!(E0766))
|
||||
.with_code(E0766)
|
||||
.emit()
|
||||
}
|
||||
self.cook_unicode(token::ByteStr, Mode::ByteStr, start, end, 2, 1) // b" "
|
||||
@ -445,7 +445,7 @@ impl<'sess, 'src> StringReader<'sess, 'src> {
|
||||
self.mk_sp(start + BytePos(1), end),
|
||||
"unterminated C string",
|
||||
)
|
||||
.with_code(error_code!(E0767))
|
||||
.with_code(E0767)
|
||||
.emit()
|
||||
}
|
||||
self.cook_mixed(token::CStr, Mode::CStr, start, end, 2, 1) // c" "
|
||||
@ -582,7 +582,7 @@ impl<'sess, 'src> StringReader<'sess, 'src> {
|
||||
) -> ! {
|
||||
let mut err =
|
||||
self.dcx().struct_span_fatal(self.mk_sp(start, start), "unterminated raw string");
|
||||
err.code(error_code!(E0748));
|
||||
err.code(E0748);
|
||||
err.span_label(self.mk_sp(start, start), "unterminated raw string");
|
||||
|
||||
if n_hashes > 0 {
|
||||
@ -614,7 +614,7 @@ impl<'sess, 'src> StringReader<'sess, 'src> {
|
||||
};
|
||||
let last_bpos = self.pos;
|
||||
let mut err = self.dcx().struct_span_fatal(self.mk_sp(start, last_bpos), msg);
|
||||
err.code(error_code!(E0758));
|
||||
err.code(E0758);
|
||||
let mut nested_block_comment_open_idxs = vec![];
|
||||
let mut last_nested_block_comment_idxs = None;
|
||||
let mut content_chars = self.str_from(start).char_indices().peekable();
|
||||
|
@ -8,7 +8,7 @@ use super::{AttrWrapper, Capturing, FnParseMode, ForceCollect, Parser, PathStyle
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::attr;
|
||||
use rustc_ast::token::{self, Delimiter, Nonterminal};
|
||||
use rustc_errors::{error_code, Diagnostic, PResult};
|
||||
use rustc_errors::{codes::*, Diagnostic, PResult};
|
||||
use rustc_span::{sym, BytePos, Span};
|
||||
use thin_vec::ThinVec;
|
||||
use tracing::debug;
|
||||
@ -61,7 +61,7 @@ impl<'a> Parser<'a> {
|
||||
let mut err = self
|
||||
.dcx()
|
||||
.struct_span_err(span, fluent::parse_inner_doc_comment_not_permitted);
|
||||
err.code(error_code!(E0753));
|
||||
err.code(E0753);
|
||||
if let Some(replacement_span) = self.annotate_following_item_if_applicable(
|
||||
&mut err,
|
||||
span,
|
||||
|
@ -10,7 +10,7 @@ use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
|
||||
use rustc_ast::util::case::Case;
|
||||
use rustc_ast::{self as ast};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_errors::{struct_span_code_err, Applicability, PResult, StashKey};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, Applicability, PResult, StashKey};
|
||||
use rustc_span::edit_distance::edit_distance;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_ast::attr;
|
||||
use rustc_ast::entry::EntryPointType;
|
||||
use rustc_errors::error_code;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
|
||||
use rustc_hir::{ItemId, Node, CRATE_HIR_ID};
|
||||
@ -180,8 +180,8 @@ fn no_main_err(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) {
|
||||
Default::default()
|
||||
});
|
||||
let main_def_opt = tcx.resolutions(()).main_def;
|
||||
let code = error_code!(E0601);
|
||||
let add_teach_note = tcx.sess.teach(&code);
|
||||
let code = E0601;
|
||||
let add_teach_note = tcx.sess.teach(code);
|
||||
// The file may be empty, which leads to the diagnostic machinery not emitting this
|
||||
// note. This is a relatively simple way to detect that case and emit a span-less
|
||||
// note instead.
|
||||
|
@ -6,7 +6,7 @@ use std::{
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_ast::Label;
|
||||
use rustc_errors::{
|
||||
error_code, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
|
||||
codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
|
||||
DiagnosticSymbolList, EmissionGuarantee, IntoDiagnostic, Level, MultiSpan,
|
||||
};
|
||||
use rustc_hir::{self as hir, ExprKind, Target};
|
||||
@ -55,7 +55,7 @@ pub struct IgnoredInlineAttrFnProto;
|
||||
pub struct IgnoredInlineAttrConstants;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_inline_not_fn_or_closure, code = "E0518")]
|
||||
#[diag(passes_inline_not_fn_or_closure, code = E0518)]
|
||||
pub struct InlineNotFnOrClosure {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
@ -76,7 +76,7 @@ pub struct IgnoredCoveragePropagate;
|
||||
pub struct IgnoredCoverageFnDefn;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_coverage_not_coverable, code = "E0788")]
|
||||
#[diag(passes_coverage_not_coverable, code = E0788)]
|
||||
pub struct IgnoredCoverageNotCoverable {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
@ -95,14 +95,14 @@ pub struct AttrShouldBeAppliedToFn {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_naked_tracked_caller, code = "E0736")]
|
||||
#[diag(passes_naked_tracked_caller, code = E0736)]
|
||||
pub struct NakedTrackedCaller {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_should_be_applied_to_fn, code = "E0739")]
|
||||
#[diag(passes_should_be_applied_to_fn, code = E0739)]
|
||||
pub struct TrackedCallerWrongLocation {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
@ -112,7 +112,7 @@ pub struct TrackedCallerWrongLocation {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_should_be_applied_to_struct_enum, code = "E0701")]
|
||||
#[diag(passes_should_be_applied_to_struct_enum, code = E0701)]
|
||||
pub struct NonExhaustiveWrongLocation {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
@ -370,28 +370,28 @@ pub struct HasIncoherentInherentImpl {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_both_ffi_const_and_pure, code = "E0757")]
|
||||
#[diag(passes_both_ffi_const_and_pure, code = E0757)]
|
||||
pub struct BothFfiConstAndPure {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_ffi_pure_invalid_target, code = "E0755")]
|
||||
#[diag(passes_ffi_pure_invalid_target, code = E0755)]
|
||||
pub struct FfiPureInvalidTarget {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_ffi_const_invalid_target, code = "E0756")]
|
||||
#[diag(passes_ffi_const_invalid_target, code = E0756)]
|
||||
pub struct FfiConstInvalidTarget {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_ffi_returns_twice_invalid_target, code = "E0724")]
|
||||
#[diag(passes_ffi_returns_twice_invalid_target, code = E0724)]
|
||||
pub struct FfiReturnsTwiceInvalidTarget {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
@ -552,21 +552,21 @@ pub struct NoMangle {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_repr_ident, code = "E0565")]
|
||||
#[diag(passes_repr_ident, code = E0565)]
|
||||
pub struct ReprIdent {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_repr_conflicting, code = "E0566")]
|
||||
#[diag(passes_repr_conflicting, code = E0566)]
|
||||
pub struct ReprConflicting {
|
||||
#[primary_span]
|
||||
pub hint_spans: Vec<Span>,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(passes_repr_conflicting, code = "E0566")]
|
||||
#[diag(passes_repr_conflicting, code = E0566)]
|
||||
pub struct ReprConflictingLint;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
@ -667,7 +667,7 @@ pub(crate) struct EmptyConfusables {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_incorrect_meta_item, code = "E0539")]
|
||||
#[diag(passes_incorrect_meta_item, code = E0539)]
|
||||
pub(crate) struct IncorrectMetaItem {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -737,7 +737,7 @@ pub struct Unused {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_non_exported_macro_invalid_attrs, code = "E0518")]
|
||||
#[diag(passes_non_exported_macro_invalid_attrs, code = E0518)]
|
||||
pub struct NonExportedMacroInvalidAttrs {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -801,7 +801,7 @@ pub struct DeprecatedAnnotationHasNoEffect {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_unknown_external_lang_item, code = "E0264")]
|
||||
#[diag(passes_unknown_external_lang_item, code = E0264)]
|
||||
pub struct UnknownExternLangItem {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -837,7 +837,7 @@ pub struct LangItemWithTargetFeature {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_lang_item_on_incorrect_target, code = "E0718")]
|
||||
#[diag(passes_lang_item_on_incorrect_target, code = E0718)]
|
||||
pub struct LangItemOnIncorrectTarget {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -848,7 +848,7 @@ pub struct LangItemOnIncorrectTarget {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_unknown_lang_item, code = "E0522")]
|
||||
#[diag(passes_unknown_lang_item, code = E0522)]
|
||||
pub struct UnknownLangItem {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -990,7 +990,7 @@ pub struct UnrecognizedField {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_feature_stable_twice, code = "E0711")]
|
||||
#[diag(passes_feature_stable_twice, code = E0711)]
|
||||
pub struct FeatureStableTwice {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1000,7 +1000,7 @@ pub struct FeatureStableTwice {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_feature_previously_declared, code = "E0711")]
|
||||
#[diag(passes_feature_previously_declared, code = E0711)]
|
||||
pub struct FeaturePreviouslyDeclared<'a, 'b> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1025,7 +1025,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'_, G> for BreakNonLoop<'a> {
|
||||
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> DiagnosticBuilder<'_, G> {
|
||||
let mut diag = DiagnosticBuilder::new(dcx, level, fluent::passes_break_non_loop);
|
||||
diag.span(self.span);
|
||||
diag.code(error_code!(E0571));
|
||||
diag.code(E0571);
|
||||
diag.arg("kind", self.kind);
|
||||
diag.span_label(self.span, fluent::passes_label);
|
||||
if let Some(head) = self.head {
|
||||
@ -1063,7 +1063,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'_, G> for BreakNonLoop<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_continue_labeled_block, code = "E0696")]
|
||||
#[diag(passes_continue_labeled_block, code = E0696)]
|
||||
pub struct ContinueLabeledBlock {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1073,7 +1073,7 @@ pub struct ContinueLabeledBlock {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_break_inside_closure, code = "E0267")]
|
||||
#[diag(passes_break_inside_closure, code = E0267)]
|
||||
pub struct BreakInsideClosure<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1084,7 +1084,7 @@ pub struct BreakInsideClosure<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_break_inside_async_block, code = "E0267")]
|
||||
#[diag(passes_break_inside_async_block, code = E0267)]
|
||||
pub struct BreakInsideAsyncBlock<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1095,7 +1095,7 @@ pub struct BreakInsideAsyncBlock<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_outside_loop, code = "E0268")]
|
||||
#[diag(passes_outside_loop, code = E0268)]
|
||||
pub struct OutsideLoop<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1115,7 +1115,7 @@ pub struct OutsideLoopSuggestion {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_unlabeled_in_labeled_block, code = "E0695")]
|
||||
#[diag(passes_unlabeled_in_labeled_block, code = E0695)]
|
||||
pub struct UnlabeledInLabeledBlock<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1124,7 +1124,7 @@ pub struct UnlabeledInLabeledBlock<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_unlabeled_cf_in_while_condition, code = "E0590")]
|
||||
#[diag(passes_unlabeled_cf_in_while_condition, code = E0590)]
|
||||
pub struct UnlabeledCfInWhileCondition<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -1169,7 +1169,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for NakedFunctionsAsmBlock {
|
||||
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> DiagnosticBuilder<'_, G> {
|
||||
let mut diag = DiagnosticBuilder::new(dcx, level, fluent::passes_naked_functions_asm_block);
|
||||
diag.span(self.span);
|
||||
diag.code(error_code!(E0787));
|
||||
diag.code(E0787);
|
||||
for span in self.multiple_asms.iter() {
|
||||
diag.span_label(*span, fluent::passes_label_multiple_asm);
|
||||
}
|
||||
@ -1181,14 +1181,14 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for NakedFunctionsAsmBlock {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_naked_functions_operands, code = "E0787")]
|
||||
#[diag(passes_naked_functions_operands, code = E0787)]
|
||||
pub struct NakedFunctionsOperands {
|
||||
#[primary_span]
|
||||
pub unsupported_operands: Vec<Span>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_naked_functions_asm_options, code = "E0787")]
|
||||
#[diag(passes_naked_functions_asm_options, code = E0787)]
|
||||
pub struct NakedFunctionsAsmOptions {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1196,7 +1196,7 @@ pub struct NakedFunctionsAsmOptions {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_naked_functions_must_use_noreturn, code = "E0787")]
|
||||
#[diag(passes_naked_functions_must_use_noreturn, code = E0787)]
|
||||
pub struct NakedFunctionsMustUseNoreturn {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1229,7 +1229,7 @@ pub struct AttrOnlyInFunctions {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_multiple_rustc_main, code = "E0137")]
|
||||
#[diag(passes_multiple_rustc_main, code = E0137)]
|
||||
pub struct MultipleRustcMain {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1240,7 +1240,7 @@ pub struct MultipleRustcMain {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_multiple_start_functions, code = "E0138")]
|
||||
#[diag(passes_multiple_start_functions, code = E0138)]
|
||||
pub struct MultipleStartFunctions {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1280,7 +1280,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for NoMainErr {
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
let mut diag = DiagnosticBuilder::new(dcx, level, fluent::passes_no_main_function);
|
||||
diag.span(DUMMY_SP);
|
||||
diag.code(error_code!(E0601));
|
||||
diag.code(E0601);
|
||||
diag.arg("crate_name", self.crate_name);
|
||||
diag.arg("filename", self.filename);
|
||||
diag.arg("has_filename", self.has_filename);
|
||||
@ -1345,7 +1345,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for DuplicateLangItem {
|
||||
Duplicate::CrateDepends => fluent::passes_duplicate_lang_item_crate_depends,
|
||||
},
|
||||
);
|
||||
diag.code(error_code!(E0152));
|
||||
diag.code(E0152);
|
||||
diag.arg("lang_item_name", self.lang_item_name);
|
||||
diag.arg("crate_name", self.crate_name);
|
||||
diag.arg("dependency_of", self.dependency_of);
|
||||
@ -1382,7 +1382,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for DuplicateLangItem {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_incorrect_target, code = "E0718")]
|
||||
#[diag(passes_incorrect_target, code = E0718)]
|
||||
pub struct IncorrectTarget<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1418,7 +1418,7 @@ pub struct ObjectLifetimeErr {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_unrecognized_repr_hint, code = "E0552")]
|
||||
#[diag(passes_unrecognized_repr_hint, code = E0552)]
|
||||
#[help]
|
||||
pub struct UnrecognizedReprHint {
|
||||
#[primary_span]
|
||||
@ -1427,35 +1427,35 @@ pub struct UnrecognizedReprHint {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum AttrApplication {
|
||||
#[diag(passes_attr_application_enum, code = "E0517")]
|
||||
#[diag(passes_attr_application_enum, code = E0517)]
|
||||
Enum {
|
||||
#[primary_span]
|
||||
hint_span: Span,
|
||||
#[label]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(passes_attr_application_struct, code = "E0517")]
|
||||
#[diag(passes_attr_application_struct, code = E0517)]
|
||||
Struct {
|
||||
#[primary_span]
|
||||
hint_span: Span,
|
||||
#[label]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(passes_attr_application_struct_union, code = "E0517")]
|
||||
#[diag(passes_attr_application_struct_union, code = E0517)]
|
||||
StructUnion {
|
||||
#[primary_span]
|
||||
hint_span: Span,
|
||||
#[label]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(passes_attr_application_struct_enum_union, code = "E0517")]
|
||||
#[diag(passes_attr_application_struct_enum_union, code = E0517)]
|
||||
StructEnumUnion {
|
||||
#[primary_span]
|
||||
hint_span: Span,
|
||||
#[label]
|
||||
span: Span,
|
||||
},
|
||||
#[diag(passes_attr_application_struct_enum_function_method_union, code = "E0517")]
|
||||
#[diag(passes_attr_application_struct_enum_function_method_union, code = E0517)]
|
||||
StructEnumFunctionMethodUnion {
|
||||
#[primary_span]
|
||||
hint_span: Span,
|
||||
@ -1465,7 +1465,7 @@ pub enum AttrApplication {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_transparent_incompatible, code = "E0692")]
|
||||
#[diag(passes_transparent_incompatible, code = E0692)]
|
||||
pub struct TransparentIncompatible {
|
||||
#[primary_span]
|
||||
pub hint_spans: Vec<Span>,
|
||||
@ -1473,7 +1473,7 @@ pub struct TransparentIncompatible {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_deprecated_attribute, code = "E0549")]
|
||||
#[diag(passes_deprecated_attribute, code = E0549)]
|
||||
pub struct DeprecatedAttribute {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1524,7 +1524,7 @@ pub struct TraitImplConstStable {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_feature_only_on_nightly, code = "E0554")]
|
||||
#[diag(passes_feature_only_on_nightly, code = E0554)]
|
||||
pub struct FeatureOnlyOnNightly {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1532,7 +1532,7 @@ pub struct FeatureOnlyOnNightly {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_unknown_feature, code = "E0635")]
|
||||
#[diag(passes_unknown_feature, code = E0635)]
|
||||
pub struct UnknownFeature {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -1549,7 +1549,7 @@ pub struct ImpliedFeatureNotExist {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_duplicate_feature_err, code = "E0636")]
|
||||
#[diag(passes_duplicate_feature_err, code = E0636)]
|
||||
pub struct DuplicateFeatureErr {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -1,9 +1,9 @@
|
||||
use rustc_errors::DiagnosticArgFromDisplay;
|
||||
use rustc_errors::{codes::*, DiagnosticArgFromDisplay};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(privacy_field_is_private, code = "E0451")]
|
||||
#[diag(privacy_field_is_private, code = E0451)]
|
||||
pub struct FieldIsPrivate {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
@ -48,7 +48,7 @@ pub struct UnnamedItemIsPrivate {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(privacy_in_public_interface, code = "E0446")]
|
||||
#[diag(privacy_in_public_interface, code = E0446)]
|
||||
pub struct InPublicInterface<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
|
@ -1,3 +1,4 @@
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::{Span, Symbol};
|
||||
@ -45,7 +46,7 @@ pub struct CycleUsage {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(query_system_cycle, code = "E0391")]
|
||||
#[diag(query_system_cycle, code = E0391)]
|
||||
pub struct Cycle {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
@ -19,7 +19,7 @@ use rustc_ast::{self as ast, AssocItem, AssocItemKind, MetaItemKind, StmtKind};
|
||||
use rustc_ast::{Block, ForeignItem, ForeignItemKind, Impl, Item, ItemKind, NodeId};
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{struct_span_code_err, Applicability};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, Applicability};
|
||||
use rustc_expand::expand::AstFragment;
|
||||
use rustc_hir::def::{self, *};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
|
||||
|
@ -6,8 +6,8 @@ use rustc_ast::{MetaItemKind, NestedMetaItem};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{
|
||||
pluralize, report_ambiguity_error, struct_span_code_err, Applicability, DiagCtxt, Diagnostic,
|
||||
DiagnosticBuilder, ErrorGuaranteed, MultiSpan, SuggestionStyle,
|
||||
codes::*, pluralize, report_ambiguity_error, struct_span_code_err, Applicability, DiagCtxt,
|
||||
Diagnostic, DiagnosticBuilder, ErrorGuaranteed, MultiSpan, SuggestionStyle,
|
||||
};
|
||||
use rustc_feature::BUILTIN_ATTRIBUTES;
|
||||
use rustc_hir::def::Namespace::{self, *};
|
||||
|
@ -1,3 +1,4 @@
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_span::{
|
||||
symbol::{Ident, Symbol},
|
||||
@ -7,16 +8,16 @@ use rustc_span::{
|
||||
use crate::{late::PatternSource, Res};
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_parent_module_reset_for_binding, code = "E0637")]
|
||||
#[diag(resolve_parent_module_reset_for_binding, code = E0637)]
|
||||
pub(crate) struct ParentModuleResetForBinding;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_ampersand_used_without_explicit_lifetime_name, code = "E0637")]
|
||||
#[diag(resolve_ampersand_used_without_explicit_lifetime_name, code = E0637)]
|
||||
#[note]
|
||||
pub(crate) struct AmpersandUsedWithoutExplicitLifetimeName(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_underscore_lifetime_name_cannot_be_used_here, code = "E0637")]
|
||||
#[diag(resolve_underscore_lifetime_name_cannot_be_used_here, code = E0637)]
|
||||
#[note]
|
||||
pub(crate) struct UnderscoreLifetimeNameCannotBeUsedHere(#[primary_span] pub(crate) Span);
|
||||
|
||||
@ -33,7 +34,7 @@ pub(crate) struct CrateRootNamesMustBeNamedExplicitly(#[primary_span] pub(crate)
|
||||
pub(crate) struct ResolutionError(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_generic_params_from_outer_item, code = "E0401")]
|
||||
#[diag(resolve_generic_params_from_outer_item, code = E0401)]
|
||||
pub(crate) struct GenericParamsFromOuterItem {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -67,7 +68,7 @@ pub(crate) struct GenericParamsFromOuterItemSugg {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_name_is_already_used_as_generic_parameter, code = "E0403")]
|
||||
#[diag(resolve_name_is_already_used_as_generic_parameter, code = E0403)]
|
||||
pub(crate) struct NameAlreadyUsedInParameterList {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -78,7 +79,7 @@ pub(crate) struct NameAlreadyUsedInParameterList {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_method_not_member_of_trait, code = "E0407")]
|
||||
#[diag(resolve_method_not_member_of_trait, code = E0407)]
|
||||
pub(crate) struct MethodNotMemberOfTrait {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -102,7 +103,7 @@ pub(crate) struct AssociatedFnWithSimilarNameExists {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_type_not_member_of_trait, code = "E0437")]
|
||||
#[diag(resolve_type_not_member_of_trait, code = E0437)]
|
||||
pub(crate) struct TypeNotMemberOfTrait {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -126,7 +127,7 @@ pub(crate) struct AssociatedTypeWithSimilarNameExists {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_const_not_member_of_trait, code = "E0438")]
|
||||
#[diag(resolve_const_not_member_of_trait, code = E0438)]
|
||||
pub(crate) struct ConstNotMemberOfTrait {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -150,7 +151,7 @@ pub(crate) struct AssociatedConstWithSimilarNameExists {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_variable_bound_with_different_mode, code = "E0409")]
|
||||
#[diag(resolve_variable_bound_with_different_mode, code = E0409)]
|
||||
pub(crate) struct VariableBoundWithDifferentMode {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -161,7 +162,7 @@ pub(crate) struct VariableBoundWithDifferentMode {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_ident_bound_more_than_once_in_parameter_list, code = "E0415")]
|
||||
#[diag(resolve_ident_bound_more_than_once_in_parameter_list, code = E0415)]
|
||||
pub(crate) struct IdentifierBoundMoreThanOnceInParameterList {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -170,7 +171,7 @@ pub(crate) struct IdentifierBoundMoreThanOnceInParameterList {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_ident_bound_more_than_once_in_same_pattern, code = "E0416")]
|
||||
#[diag(resolve_ident_bound_more_than_once_in_same_pattern, code = E0416)]
|
||||
pub(crate) struct IdentifierBoundMoreThanOnceInSamePattern {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -179,7 +180,7 @@ pub(crate) struct IdentifierBoundMoreThanOnceInSamePattern {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_undeclared_label, code = "E0426")]
|
||||
#[diag(resolve_undeclared_label, code = E0426)]
|
||||
pub(crate) struct UndeclaredLabel {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -217,7 +218,7 @@ pub(crate) struct UnreachableLabelWithSimilarNameExists {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_self_import_can_only_appear_once_in_the_list, code = "E0430")]
|
||||
#[diag(resolve_self_import_can_only_appear_once_in_the_list, code = E0430)]
|
||||
pub(crate) struct SelfImportCanOnlyAppearOnceInTheList {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -225,7 +226,7 @@ pub(crate) struct SelfImportCanOnlyAppearOnceInTheList {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_self_import_only_in_import_list_with_non_empty_prefix, code = "E0431")]
|
||||
#[diag(resolve_self_import_only_in_import_list_with_non_empty_prefix, code = E0431)]
|
||||
pub(crate) struct SelfImportOnlyInImportListWithNonEmptyPrefix {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -233,7 +234,7 @@ pub(crate) struct SelfImportOnlyInImportListWithNonEmptyPrefix {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_cannot_capture_dynamic_environment_in_fn_item, code = "E0434")]
|
||||
#[diag(resolve_cannot_capture_dynamic_environment_in_fn_item, code = E0434)]
|
||||
#[help]
|
||||
pub(crate) struct CannotCaptureDynamicEnvironmentInFnItem {
|
||||
#[primary_span]
|
||||
@ -241,7 +242,7 @@ pub(crate) struct CannotCaptureDynamicEnvironmentInFnItem {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_attempt_to_use_non_constant_value_in_constant, code = "E0435")]
|
||||
#[diag(resolve_attempt_to_use_non_constant_value_in_constant, code = E0435)]
|
||||
pub(crate) struct AttemptToUseNonConstantValueInConstant<'a> {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
@ -283,7 +284,7 @@ pub(crate) struct AttemptToUseNonConstantValueInConstantWithoutSuggestion<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_self_imports_only_allowed_within, code = "E0429")]
|
||||
#[diag(resolve_self_imports_only_allowed_within, code = E0429)]
|
||||
pub(crate) struct SelfImportsOnlyAllowedWithin {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
@ -317,7 +318,7 @@ pub(crate) struct SelfImportsOnlyAllowedWithinMultipartSuggestion {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_binding_shadows_something_unacceptable, code = "E0530")]
|
||||
#[diag(resolve_binding_shadows_something_unacceptable, code = E0530)]
|
||||
pub(crate) struct BindingShadowsSomethingUnacceptable<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -346,7 +347,7 @@ pub(crate) struct BindingShadowsSomethingUnacceptableSuggestion {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_forward_declared_generic_param, code = "E0128")]
|
||||
#[diag(resolve_forward_declared_generic_param, code = E0128)]
|
||||
pub(crate) struct ForwardDeclaredGenericParam {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -354,7 +355,7 @@ pub(crate) struct ForwardDeclaredGenericParam {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_param_in_ty_of_const_param, code = "E0770")]
|
||||
#[diag(resolve_param_in_ty_of_const_param, code = E0770)]
|
||||
pub(crate) struct ParamInTyOfConstParam {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -376,7 +377,7 @@ pub(crate) enum ParamKindInTyOfConstParam {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_self_in_generic_param_default, code = "E0735")]
|
||||
#[diag(resolve_self_in_generic_param_default, code = E0735)]
|
||||
pub(crate) struct SelfInGenericParamDefault {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -412,7 +413,7 @@ pub(crate) enum ParamKindInNonTrivialAnonConst {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_unreachable_label, code = "E0767")]
|
||||
#[diag(resolve_unreachable_label, code = E0767)]
|
||||
#[note]
|
||||
pub(crate) struct UnreachableLabel {
|
||||
#[primary_span]
|
||||
@ -495,7 +496,7 @@ pub(crate) struct BindingInNeverPattern {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_trait_impl_duplicate, code = "E0201")]
|
||||
#[diag(resolve_trait_impl_duplicate, code = E0201)]
|
||||
pub(crate) struct TraitImplDuplicate {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -518,11 +519,11 @@ pub(crate) struct Relative2018 {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_ancestor_only, code = "E0742")]
|
||||
#[diag(resolve_ancestor_only, code = E0742)]
|
||||
pub(crate) struct AncestorOnly(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_expected_found, code = "E0577")]
|
||||
#[diag(resolve_expected_found, code = E0577)]
|
||||
pub(crate) struct ExpectedFound {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -532,7 +533,7 @@ pub(crate) struct ExpectedFound {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_indeterminate, code = "E0578")]
|
||||
#[diag(resolve_indeterminate, code = E0578)]
|
||||
pub(crate) struct Indeterminate(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
@ -714,7 +715,7 @@ pub(crate) struct CannotDetermineMacroResolution {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_cannot_be_reexported_private, code = "E0364")]
|
||||
#[diag(resolve_cannot_be_reexported_private, code = E0364)]
|
||||
pub(crate) struct CannotBeReexportedPrivate {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
@ -722,7 +723,7 @@ pub(crate) struct CannotBeReexportedPrivate {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_cannot_be_reexported_crate_public, code = "E0364")]
|
||||
#[diag(resolve_cannot_be_reexported_crate_public, code = E0364)]
|
||||
pub(crate) struct CannotBeReexportedCratePublic {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
@ -730,7 +731,7 @@ pub(crate) struct CannotBeReexportedCratePublic {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_cannot_be_reexported_private, code = "E0365")]
|
||||
#[diag(resolve_cannot_be_reexported_private, code = E0365)]
|
||||
#[note(resolve_consider_declaring_with_pub)]
|
||||
pub(crate) struct CannotBeReexportedPrivateNS {
|
||||
#[primary_span]
|
||||
@ -740,7 +741,7 @@ pub(crate) struct CannotBeReexportedPrivateNS {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_cannot_be_reexported_crate_public, code = "E0365")]
|
||||
#[diag(resolve_cannot_be_reexported_crate_public, code = E0365)]
|
||||
#[note(resolve_consider_declaring_with_pub)]
|
||||
pub(crate) struct CannotBeReexportedCratePublicNS {
|
||||
#[primary_span]
|
||||
@ -779,7 +780,7 @@ pub(crate) struct ItemsInTraitsAreNotImportable {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_is_not_directly_importable, code = "E0253")]
|
||||
#[diag(resolve_is_not_directly_importable, code = E0253)]
|
||||
pub(crate) struct IsNotDirectlyImportable {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
|
@ -17,7 +17,7 @@ use crate::{NameBinding, NameBindingData, NameBindingKind, PathResult};
|
||||
use rustc_ast::NodeId;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_errors::{pluralize, struct_span_code_err, Applicability, MultiSpan};
|
||||
use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, MultiSpan};
|
||||
use rustc_hir::def::{self, DefKind, PartialRes};
|
||||
use rustc_middle::metadata::ModChild;
|
||||
use rustc_middle::metadata::Reexport;
|
||||
|
@ -16,7 +16,9 @@ use rustc_ast::ptr::P;
|
||||
use rustc_ast::visit::{self, AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor};
|
||||
use rustc_ast::*;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
|
||||
use rustc_errors::{Applicability, DiagnosticArgValue, IntoDiagnosticArg};
|
||||
use rustc_errors::{
|
||||
codes::*, struct_span_code_err, Applicability, DiagnosticArgValue, ErrCode, IntoDiagnosticArg,
|
||||
};
|
||||
use rustc_hir::def::Namespace::{self, *};
|
||||
use rustc_hir::def::{self, CtorKind, DefKind, LifetimeRes, NonMacroAttrKind, PartialRes, PerNS};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
|
||||
@ -533,21 +535,20 @@ impl<'a> PathSource<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn error_code(self, has_unexpected_resolution: bool) -> String {
|
||||
use rustc_errors::error_code;
|
||||
fn error_code(self, has_unexpected_resolution: bool) -> ErrCode {
|
||||
match (self, has_unexpected_resolution) {
|
||||
(PathSource::Trait(_), true) => error_code!(E0404),
|
||||
(PathSource::Trait(_), false) => error_code!(E0405),
|
||||
(PathSource::Type, true) => error_code!(E0573),
|
||||
(PathSource::Type, false) => error_code!(E0412),
|
||||
(PathSource::Struct, true) => error_code!(E0574),
|
||||
(PathSource::Struct, false) => error_code!(E0422),
|
||||
(PathSource::Expr(..), true) | (PathSource::Delegation, true) => error_code!(E0423),
|
||||
(PathSource::Expr(..), false) | (PathSource::Delegation, false) => error_code!(E0425),
|
||||
(PathSource::Pat | PathSource::TupleStruct(..), true) => error_code!(E0532),
|
||||
(PathSource::Pat | PathSource::TupleStruct(..), false) => error_code!(E0531),
|
||||
(PathSource::TraitItem(..), true) => error_code!(E0575),
|
||||
(PathSource::TraitItem(..), false) => error_code!(E0576),
|
||||
(PathSource::Trait(_), true) => E0404,
|
||||
(PathSource::Trait(_), false) => E0405,
|
||||
(PathSource::Type, true) => E0573,
|
||||
(PathSource::Type, false) => E0412,
|
||||
(PathSource::Struct, true) => E0574,
|
||||
(PathSource::Struct, false) => E0422,
|
||||
(PathSource::Expr(..), true) | (PathSource::Delegation, true) => E0423,
|
||||
(PathSource::Expr(..), false) | (PathSource::Delegation, false) => E0425,
|
||||
(PathSource::Pat | PathSource::TupleStruct(..), true) => E0532,
|
||||
(PathSource::Pat | PathSource::TupleStruct(..), false) => E0531,
|
||||
(PathSource::TraitItem(..), true) => E0575,
|
||||
(PathSource::TraitItem(..), false) => E0576,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1673,13 +1674,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
} else {
|
||||
("`'_` cannot be used here", "`'_` is a reserved lifetime name")
|
||||
};
|
||||
let mut diag = rustc_errors::struct_span_code_err!(
|
||||
self.r.dcx(),
|
||||
lifetime.ident.span,
|
||||
E0637,
|
||||
"{}",
|
||||
msg,
|
||||
);
|
||||
let mut diag =
|
||||
struct_span_code_err!(self.r.dcx(), lifetime.ident.span, E0637, "{}", msg,);
|
||||
diag.span_label(lifetime.ident.span, note);
|
||||
if elided {
|
||||
for rib in self.lifetime_ribs[i..].iter().rev() {
|
||||
@ -1863,7 +1859,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
LifetimeRibKind::AnonymousCreateParameter { report_in_path: true, .. }
|
||||
| LifetimeRibKind::AnonymousWarn(_) => {
|
||||
let sess = self.r.tcx.sess;
|
||||
let mut err = rustc_errors::struct_span_code_err!(
|
||||
let mut err = struct_span_code_err!(
|
||||
sess.dcx(),
|
||||
path_span,
|
||||
E0726,
|
||||
@ -2608,7 +2604,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
}
|
||||
|
||||
if param.ident.name == kw::UnderscoreLifetime {
|
||||
rustc_errors::struct_span_code_err!(
|
||||
struct_span_code_err!(
|
||||
self.r.dcx(),
|
||||
param.ident.span,
|
||||
E0637,
|
||||
@ -2622,7 +2618,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
}
|
||||
|
||||
if param.ident.name == kw::StaticLifetime {
|
||||
rustc_errors::struct_span_code_err!(
|
||||
struct_span_code_err!(
|
||||
self.r.dcx(),
|
||||
param.ident.span,
|
||||
E0262,
|
||||
@ -3164,10 +3160,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
// The method kind does not correspond to what appeared in the trait, report.
|
||||
let path = &self.current_trait_ref.as_ref().unwrap().1.path;
|
||||
let (code, kind) = match kind {
|
||||
AssocItemKind::Const(..) => (rustc_errors::error_code!(E0323), "const"),
|
||||
AssocItemKind::Fn(..) => (rustc_errors::error_code!(E0324), "method"),
|
||||
AssocItemKind::Type(..) => (rustc_errors::error_code!(E0325), "type"),
|
||||
AssocItemKind::Delegation(..) => (rustc_errors::error_code!(E0324), "method"),
|
||||
AssocItemKind::Const(..) => (E0323, "const"),
|
||||
AssocItemKind::Fn(..) => (E0324, "method"),
|
||||
AssocItemKind::Type(..) => (E0325, "type"),
|
||||
AssocItemKind::Delegation(..) => (E0324, "method"),
|
||||
AssocItemKind::MacCall(..) => span_bug!(span, "unexpanded macro"),
|
||||
};
|
||||
let trait_path = path_names_to_string(path);
|
||||
|
@ -16,8 +16,8 @@ use rustc_ast::{
|
||||
use rustc_ast_pretty::pprust::where_bound_predicate_to_string;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{
|
||||
pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
|
||||
MultiSpan, SuggestionStyle,
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
ErrorGuaranteed, MultiSpan, SuggestionStyle,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{self, CtorKind, CtorOf, DefKind};
|
||||
@ -922,8 +922,8 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
||||
path: &[Segment],
|
||||
span: Span,
|
||||
) {
|
||||
if let Some(err_code) = &err.code {
|
||||
if err_code == &rustc_errors::error_code!(E0425) {
|
||||
if let Some(err_code) = err.code {
|
||||
if err_code == E0425 {
|
||||
for label_rib in &self.label_ribs {
|
||||
for (label_ident, node_id) in &label_rib.bindings {
|
||||
let ident = path.last().unwrap().ident;
|
||||
@ -946,7 +946,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if err_code == &rustc_errors::error_code!(E0412) {
|
||||
} else if err_code == E0412 {
|
||||
if let Some(correct) = Self::likely_rust_type(path) {
|
||||
err.span_suggestion(
|
||||
span,
|
||||
@ -970,7 +970,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
||||
if !is_self_type(path, source.namespace()) {
|
||||
return false;
|
||||
}
|
||||
err.code(rustc_errors::error_code!(E0411));
|
||||
err.code(E0411);
|
||||
err.span_label(span, "`Self` is only available in impls, traits, and type definitions");
|
||||
if let Some(item_kind) = self.diagnostic_metadata.current_item {
|
||||
if !item_kind.ident.span.is_dummy() {
|
||||
@ -999,7 +999,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
||||
}
|
||||
|
||||
debug!("smart_resolve_path_fragment: E0424, source={:?}", source);
|
||||
err.code(rustc_errors::error_code!(E0424));
|
||||
err.code(E0424);
|
||||
err.span_label(
|
||||
span,
|
||||
match source {
|
||||
|
@ -35,7 +35,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_data_structures::steal::Steal;
|
||||
use rustc_data_structures::sync::{FreezeReadGuard, Lrc};
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder};
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, ErrCode};
|
||||
use rustc_expand::base::{DeriveResolutions, SyntaxExtension, SyntaxExtensionKind};
|
||||
use rustc_feature::BUILTIN_ATTRIBUTES;
|
||||
use rustc_hir::def::Namespace::{self, *};
|
||||
@ -256,7 +256,7 @@ enum ResolutionError<'a> {
|
||||
kind: &'static str,
|
||||
trait_path: String,
|
||||
trait_item_span: Span,
|
||||
code: String,
|
||||
code: ErrCode,
|
||||
},
|
||||
/// Error E0201: multiple impl items for the same trait item.
|
||||
TraitImplDuplicate { name: Symbol, trait_item_span: Span, old_span: Span },
|
||||
|
@ -15,7 +15,7 @@ use rustc_ast_pretty::pprust;
|
||||
use rustc_attr::StabilityLevel;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{struct_span_code_err, Applicability};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, Applicability};
|
||||
use rustc_expand::base::{Annotatable, DeriveResolutions, Indeterminate, ResolverExpand};
|
||||
use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind};
|
||||
use rustc_expand::compile_declarative_macro;
|
||||
|
@ -3,7 +3,7 @@ use std::num::NonZeroU32;
|
||||
use rustc_ast::token;
|
||||
use rustc_ast::util::literal::LitError;
|
||||
use rustc_errors::{
|
||||
error_code, DiagCtxt, DiagnosticBuilder, DiagnosticMessage, IntoDiagnostic, Level, MultiSpan,
|
||||
codes::*, DiagCtxt, DiagnosticBuilder, DiagnosticMessage, IntoDiagnostic, Level, MultiSpan,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_span::{Span, Symbol};
|
||||
@ -19,9 +19,7 @@ pub struct FeatureGateError {
|
||||
impl<'a> IntoDiagnostic<'a> for FeatureGateError {
|
||||
#[track_caller]
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> {
|
||||
DiagnosticBuilder::new(dcx, level, self.explain)
|
||||
.with_span(self.span)
|
||||
.with_code(error_code!(E0658))
|
||||
DiagnosticBuilder::new(dcx, level, self.explain).with_span(self.span).with_code(E0658)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ use rustc_errors::emitter::{DynEmitter, HumanEmitter, HumanReadableErrorType};
|
||||
use rustc_errors::json::JsonEmitter;
|
||||
use rustc_errors::registry::Registry;
|
||||
use rustc_errors::{
|
||||
error_code, fallback_fluent_bundle, DiagCtxt, DiagnosticBuilder, DiagnosticMessage,
|
||||
codes::*, fallback_fluent_bundle, DiagCtxt, DiagnosticBuilder, DiagnosticMessage, ErrCode,
|
||||
ErrorGuaranteed, FatalAbort, FluentBundle, IntoDiagnostic, LazyFallbackBundle, TerminalUrl,
|
||||
};
|
||||
use rustc_macros::HashStable_Generic;
|
||||
@ -316,7 +316,7 @@ impl Session {
|
||||
) -> DiagnosticBuilder<'a> {
|
||||
let mut err = self.dcx().create_err(err);
|
||||
if err.code.is_none() {
|
||||
err.code(error_code!(E0658));
|
||||
err.code(E0658);
|
||||
}
|
||||
add_feature_diagnostics(&mut err, self, feature);
|
||||
err
|
||||
@ -893,7 +893,7 @@ impl Session {
|
||||
CodegenUnits::Default(16)
|
||||
}
|
||||
|
||||
pub fn teach(&self, code: &str) -> bool {
|
||||
pub fn teach(&self, code: ErrCode) -> bool {
|
||||
self.opts.unstable_opts.teach && self.dcx().must_teach(code)
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{
|
||||
AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder, EmissionGuarantee,
|
||||
IntoDiagnostic, Level, SubdiagnosticMessage,
|
||||
codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
|
||||
EmissionGuarantee, IntoDiagnostic, Level, SubdiagnosticMessage,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_middle::ty::{self, ClosureKind, PolyTraitRef, Ty};
|
||||
@ -25,7 +25,7 @@ pub struct UnableToConstructConstantValue<'a> {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -33,7 +33,7 @@ pub struct EmptyOnClauseInOnUnimplemented {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -41,7 +41,7 @@ pub struct InvalidOnClauseInOnUnimplemented {
|
||||
}
|
||||
|
||||
#[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]
|
||||
pub struct NoValueInOnUnimplemented {
|
||||
#[primary_span]
|
||||
@ -59,17 +59,13 @@ pub struct NegativePositiveConflict<'tcx> {
|
||||
|
||||
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for NegativePositiveConflict<'_> {
|
||||
#[track_caller]
|
||||
fn into_diagnostic(
|
||||
self,
|
||||
dcx: &DiagCtxt,
|
||||
level: Level,
|
||||
) -> rustc_errors::DiagnosticBuilder<'_, G> {
|
||||
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> DiagnosticBuilder<'_, G> {
|
||||
let mut diag =
|
||||
DiagnosticBuilder::new(dcx, level, fluent::trait_selection_negative_positive_conflict);
|
||||
diag.arg("trait_desc", self.trait_desc.print_only_trait_path().to_string());
|
||||
diag.arg("self_desc", self.self_ty.map_or_else(|| "none".to_string(), |ty| ty.to_string()));
|
||||
diag.span(self.impl_span);
|
||||
diag.code(rustc_errors::error_code!(E0751));
|
||||
diag.code(E0751);
|
||||
match self.negative_impl_span {
|
||||
Ok(span) => {
|
||||
diag.span_label(span, fluent::trait_selection_negative_implementation_here);
|
||||
@ -132,7 +128,7 @@ impl AddToDiagnostic for AdjustSignatureBorrow {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(trait_selection_closure_kind_mismatch, code = "E0525")]
|
||||
#[diag(trait_selection_closure_kind_mismatch, code = E0525)]
|
||||
pub struct ClosureKindMismatch {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::traits::{Obligation, ObligationCause, ObligationCtxt};
|
||||
use rustc_errors::{pluralize, struct_span_code_err, Applicability, DiagnosticBuilder};
|
||||
use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::Node;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
|
@ -6,7 +6,7 @@ use rustc_ast::AttrKind;
|
||||
use rustc_ast::{Attribute, MetaItem, NestedMetaItem};
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{struct_span_code_err, ErrorGuaranteed};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
|
@ -13,7 +13,7 @@ use hir::def::CtorOf;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{
|
||||
error_code, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
MultiSpan, Style, SuggestionStyle,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
@ -2014,7 +2014,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
return false;
|
||||
};
|
||||
|
||||
err.code(error_code!(E0746));
|
||||
err.code(E0746);
|
||||
err.primary_message("return type cannot have an unboxed trait object");
|
||||
err.children.clear();
|
||||
|
||||
|
@ -19,8 +19,8 @@ use crate::traits::{
|
||||
};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
|
||||
use rustc_errors::{
|
||||
pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
|
||||
MultiSpan, StashKey, Style,
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
ErrorGuaranteed, MultiSpan, StashKey, Style,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Namespace, Res};
|
||||
@ -2529,7 +2529,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
corresponding `impl` type",
|
||||
),
|
||||
);
|
||||
err.code(rustc_errors::error_code!(E0790));
|
||||
err.code(E0790);
|
||||
|
||||
if let Some(local_def_id) = data.trait_ref.def_id.as_local()
|
||||
&& let Some(hir::Node::Item(hir::Item {
|
||||
@ -3162,7 +3162,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
| ObligationCauseCode::ItemObligation(def_id)
|
||||
if self.tcx.is_fn_trait(*def_id) =>
|
||||
{
|
||||
err.code(rustc_errors::error_code!(E0059));
|
||||
err.code(E0059);
|
||||
err.primary_message(format!(
|
||||
"type parameter to bare `{}` trait must be a tuple",
|
||||
self.tcx.def_path_str(*def_id)
|
||||
|
@ -20,7 +20,7 @@ use crate::traits::{
|
||||
self, coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt,
|
||||
};
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{error_code, DelayDm, Diagnostic};
|
||||
use rustc_errors::{codes::*, DelayDm, Diagnostic};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_middle::ty::{GenericArgs, GenericArgsRef};
|
||||
@ -449,7 +449,7 @@ fn report_conflicting_impls<'tcx>(
|
||||
|| tcx.orphan_check_impl(impl_def_id).is_ok()
|
||||
{
|
||||
let mut err = tcx.dcx().struct_span_err(impl_span, msg);
|
||||
err.code(error_code!(E0119));
|
||||
err.code(E0119);
|
||||
decorate(tcx, &overlap, impl_span, &mut err);
|
||||
err.emit()
|
||||
} else {
|
||||
|
@ -1,5 +1,6 @@
|
||||
//! Errors emitted by ty_utils
|
||||
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::{GenericArg, Ty};
|
||||
use rustc_span::Span;
|
||||
@ -113,7 +114,7 @@ pub struct DuplicateArg<'tcx> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ty_utils_impl_trait_not_param, code = "E0792")]
|
||||
#[diag(ty_utils_impl_trait_not_param, code = E0792)]
|
||||
pub struct NotParam<'tcx> {
|
||||
pub arg: GenericArg<'tcx>,
|
||||
#[primary_span]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user