2022-11-15 13:24:33 +00:00
|
|
|
use rustc_ast::ast;
|
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.
2024-01-13 23:57:07 +00:00
|
|
|
use rustc_errors::codes::*;
|
2024-04-28 22:53:45 +00:00
|
|
|
use rustc_macros::{Diagnostic, Subdiagnostic};
|
2022-11-15 13:24:33 +00:00
|
|
|
use rustc_session::Limit;
|
|
|
|
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
|
|
|
|
use rustc_span::{Span, Symbol};
|
|
|
|
use std::borrow::Cow;
|
2022-08-17 14:18:19 +00:00
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(expand_expr_repeat_no_syntax_vars)]
|
2022-08-17 14:18:19 +00:00
|
|
|
pub(crate) struct NoSyntaxVarsExprRepeat {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(expand_must_repeat_once)]
|
2022-08-17 14:18:19 +00:00
|
|
|
pub(crate) struct MustRepeatOnce {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(expand_count_repetition_misplaced)]
|
2022-08-17 14:18:19 +00:00
|
|
|
pub(crate) struct CountRepetitionMisplaced {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(expand_meta_var_expr_unrecognized_var)]
|
2022-08-17 14:18:19 +00:00
|
|
|
pub(crate) struct MetaVarExprUnrecognizedVar {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub key: MacroRulesNormalizedIdent,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(expand_var_still_repeating)]
|
2022-08-17 14:18:19 +00:00
|
|
|
pub(crate) struct VarStillRepeating {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub ident: MacroRulesNormalizedIdent,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(expand_meta_var_dif_seq_matchers)]
|
2022-08-17 14:18:19 +00:00
|
|
|
pub(crate) struct MetaVarsDifSeqMatchers {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub msg: String,
|
|
|
|
}
|
2022-11-15 13:24:33 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_resolve_relative_path)]
|
|
|
|
pub(crate) struct ResolveRelativePath {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub path: String,
|
|
|
|
}
|
|
|
|
|
2024-01-10 18:36:05 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_collapse_debuginfo_illegal)]
|
|
|
|
pub(crate) struct CollapseMacroDebuginfoIllegal {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-11-15 13:24:33 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_macro_const_stability)]
|
|
|
|
pub(crate) struct MacroConstStability {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
2022-10-13 09:13:02 +00:00
|
|
|
#[label(expand_label2)]
|
2022-11-15 13:24:33 +00:00
|
|
|
pub head_span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_macro_body_stability)]
|
|
|
|
pub(crate) struct MacroBodyStability {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
2022-10-13 09:13:02 +00:00
|
|
|
#[label(expand_label2)]
|
2022-11-15 13:24:33 +00:00
|
|
|
pub head_span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_attr_no_arguments)]
|
|
|
|
pub(crate) struct AttrNoArguments {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_not_a_meta_item)]
|
|
|
|
pub(crate) struct NotAMetaItem {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_only_one_word)]
|
|
|
|
pub(crate) struct OnlyOneWord {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_cannot_be_name_of_macro)]
|
|
|
|
pub(crate) struct CannotBeNameOfMacro<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_ident: Ident,
|
|
|
|
pub macro_type: &'a str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_arg_not_attributes)]
|
|
|
|
pub(crate) struct ArgumentNotAttributes {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_attributes_wrong_form)]
|
|
|
|
pub(crate) struct AttributesWrongForm {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_attribute_meta_item)]
|
|
|
|
pub(crate) struct AttributeMetaItem {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_attribute_single_word)]
|
|
|
|
pub(crate) struct AttributeSingleWord {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_helper_attribute_name_invalid)]
|
|
|
|
pub(crate) struct HelperAttributeNameInvalid {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: Ident,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
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.
2024-01-13 23:57:07 +00:00
|
|
|
#[diag(expand_feature_removed, code = E0557)]
|
2022-11-15 13:24:33 +00:00
|
|
|
pub(crate) struct FeatureRemoved<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub reason: Option<FeatureRemovedReason<'a>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 09:13:02 +00:00
|
|
|
#[note(expand_reason)]
|
2022-11-15 13:24:33 +00:00
|
|
|
pub(crate) struct FeatureRemovedReason<'a> {
|
|
|
|
pub reason: &'a str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
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.
2024-01-13 23:57:07 +00:00
|
|
|
#[diag(expand_feature_not_allowed, code = E0725)]
|
2022-11-15 13:24:33 +00:00
|
|
|
pub(crate) struct FeatureNotAllowed {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: Symbol,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_recursion_limit_reached)]
|
|
|
|
#[help]
|
|
|
|
pub(crate) struct RecursionLimitReached<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub descr: String,
|
|
|
|
pub suggested_limit: Limit,
|
|
|
|
pub crate_name: &'a str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
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.
2024-01-13 23:57:07 +00:00
|
|
|
#[diag(expand_malformed_feature_attribute, code = E0556)]
|
2022-11-15 13:24:33 +00:00
|
|
|
pub(crate) struct MalformedFeatureAttribute {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub help: MalformedFeatureAttributeHelp,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
pub(crate) enum MalformedFeatureAttributeHelp {
|
2022-10-13 09:13:02 +00:00
|
|
|
#[label(expand_expected)]
|
2022-11-15 13:24:33 +00:00
|
|
|
Label {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
2022-10-13 09:13:02 +00:00
|
|
|
#[suggestion(expand_expected, code = "{suggestion}", applicability = "maybe-incorrect")]
|
2022-11-15 13:24:33 +00:00
|
|
|
Suggestion {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
suggestion: Symbol,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_remove_expr_not_supported)]
|
|
|
|
pub(crate) struct RemoveExprNotSupported {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
pub(crate) enum InvalidCfg {
|
|
|
|
#[diag(expand_invalid_cfg_no_parens)]
|
|
|
|
NotFollowedByParens {
|
|
|
|
#[primary_span]
|
|
|
|
#[suggestion(
|
|
|
|
expand_invalid_cfg_expected_syntax,
|
|
|
|
code = "cfg(/* predicate */)",
|
|
|
|
applicability = "has-placeholders"
|
|
|
|
)]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
#[diag(expand_invalid_cfg_no_predicate)]
|
|
|
|
NoPredicate {
|
|
|
|
#[primary_span]
|
|
|
|
#[suggestion(
|
|
|
|
expand_invalid_cfg_expected_syntax,
|
|
|
|
code = "cfg(/* predicate */)",
|
|
|
|
applicability = "has-placeholders"
|
|
|
|
)]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
#[diag(expand_invalid_cfg_multiple_predicates)]
|
|
|
|
MultiplePredicates {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
#[diag(expand_invalid_cfg_predicate_literal)]
|
|
|
|
PredicateLiteral {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_wrong_fragment_kind)]
|
|
|
|
pub(crate) struct WrongFragmentKind<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub kind: &'a str,
|
|
|
|
pub name: &'a ast::Path,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_unsupported_key_value)]
|
|
|
|
pub(crate) struct UnsupportedKeyValue {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_incomplete_parse)]
|
|
|
|
#[note]
|
|
|
|
pub(crate) struct IncompleteParse<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub token: Cow<'a, str>,
|
|
|
|
#[label]
|
|
|
|
pub label_span: Span,
|
|
|
|
pub macro_path: &'a ast::Path,
|
|
|
|
pub kind_name: &'a str,
|
2023-11-26 23:50:51 +00:00
|
|
|
#[note(expand_macro_expands_to_match_arm)]
|
|
|
|
pub expands_to_match_arm: Option<()>,
|
2022-11-15 13:24:33 +00:00
|
|
|
|
|
|
|
#[suggestion(
|
2022-10-13 09:13:02 +00:00
|
|
|
expand_suggestion_add_semi,
|
2022-11-15 13:24:33 +00:00
|
|
|
style = "verbose",
|
|
|
|
code = ";",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
pub add_semicolon: Option<Span>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_remove_node_not_supported)]
|
|
|
|
pub(crate) struct RemoveNodeNotSupported {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub descr: &'static str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_module_circular)]
|
|
|
|
pub(crate) struct ModuleCircular {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub modules: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_module_in_block)]
|
|
|
|
pub(crate) struct ModuleInBlock {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub name: Option<ModuleInBlockName>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 09:13:02 +00:00
|
|
|
#[note(expand_note)]
|
2022-11-15 13:24:33 +00:00
|
|
|
pub(crate) struct ModuleInBlockName {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: Ident,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
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.
2024-01-13 23:57:07 +00:00
|
|
|
#[diag(expand_module_file_not_found, code = E0583)]
|
2022-11-15 13:24:33 +00:00
|
|
|
#[help]
|
2023-10-20 20:03:44 +00:00
|
|
|
#[note]
|
2022-11-15 13:24:33 +00:00
|
|
|
pub(crate) struct ModuleFileNotFound {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: Ident,
|
|
|
|
pub default_path: String,
|
|
|
|
pub secondary_path: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
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.
2024-01-13 23:57:07 +00:00
|
|
|
#[diag(expand_module_multiple_candidates, code = E0761)]
|
2022-11-15 13:24:33 +00:00
|
|
|
#[help]
|
|
|
|
pub(crate) struct ModuleMultipleCandidates {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: Ident,
|
|
|
|
pub default_path: String,
|
|
|
|
pub secondary_path: String,
|
|
|
|
}
|
2022-08-19 13:48:15 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_trace_macro)]
|
|
|
|
pub struct TraceMacro {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2023-02-24 21:37:10 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_proc_macro_panicked)]
|
|
|
|
pub(crate) struct ProcMacroPanicked {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub message: Option<ProcMacroPanickedHelp>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[help(expand_help)]
|
|
|
|
pub(crate) struct ProcMacroPanickedHelp {
|
|
|
|
pub message: String,
|
|
|
|
}
|
2023-03-04 05:54:29 +00:00
|
|
|
|
2024-02-20 06:31:13 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_proc_macro_derive_panicked)]
|
|
|
|
pub(crate) struct ProcMacroDerivePanicked {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub message: Option<ProcMacroDerivePanickedHelp>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[help(expand_help)]
|
|
|
|
pub(crate) struct ProcMacroDerivePanickedHelp {
|
|
|
|
pub message: String,
|
|
|
|
}
|
|
|
|
|
2024-02-19 04:02:14 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_custom_attribute_panicked)]
|
|
|
|
pub(crate) struct CustomAttributePanicked {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub message: Option<CustomAttributePanickedHelp>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[help(expand_help)]
|
|
|
|
pub(crate) struct CustomAttributePanickedHelp {
|
|
|
|
pub message: String,
|
|
|
|
}
|
|
|
|
|
2023-03-04 05:54:29 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_proc_macro_derive_tokens)]
|
|
|
|
pub struct ProcMacroDeriveTokens {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2023-04-10 15:04:14 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_duplicate_matcher_binding)]
|
|
|
|
pub struct DuplicateMatcherBinding {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[label(expand_label2)]
|
|
|
|
pub prev: Span,
|
|
|
|
}
|
2024-02-14 03:25:57 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_invalid_fragment_specifier)]
|
|
|
|
#[help]
|
|
|
|
pub struct InvalidFragmentSpecifier {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub fragment: Ident,
|
|
|
|
pub help: String,
|
|
|
|
}
|
2024-03-20 12:31:05 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_expected_paren_or_brace)]
|
|
|
|
pub struct ExpectedParenOrBrace<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub token: Cow<'a, str>,
|
|
|
|
}
|
2024-03-15 11:21:03 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
2024-03-15 11:21:03 +00:00
|
|
|
#[diag(expand_empty_delegation_mac)]
|
|
|
|
pub(crate) struct EmptyDelegationMac {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub kind: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_glob_delegation_outside_impls)]
|
|
|
|
pub(crate) struct GlobDelegationOutsideImpls {
|
2024-03-15 11:21:03 +00:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2024-05-26 23:00:48 +00:00
|
|
|
|
2024-06-22 16:14:16 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_glob_delegation_traitless_qpath)]
|
|
|
|
pub(crate) struct GlobDelegationTraitlessQpath {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2024-05-26 23:00:48 +00:00
|
|
|
// This used to be the `proc_macro_back_compat` lint (#83125). It was later
|
|
|
|
// turned into a hard error.
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(expand_proc_macro_back_compat)]
|
|
|
|
#[note]
|
|
|
|
pub struct ProcMacroBackCompat {
|
|
|
|
pub crate_name: String,
|
|
|
|
pub fixed_version: String,
|
|
|
|
}
|