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
110 changed files with 1624 additions and 1572 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue