2022-10-20 17:51:37 +02:00
|
|
|
//! Errors emitted by `rustc_hir_analysis`.
|
2022-09-28 10:21:33 +01:00
|
|
|
|
2024-07-29 08:13:50 +10:00
|
|
|
use rustc_errors::codes::*;
|
2022-10-13 10:13:02 +01:00
|
|
|
use rustc_errors::{
|
2024-07-29 08:13:50 +10:00
|
|
|
Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, MultiSpan,
|
2022-10-13 10:13:02 +01:00
|
|
|
};
|
2023-06-05 17:08:27 +00:00
|
|
|
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
2023-11-24 09:53:10 +01:00
|
|
|
use rustc_middle::ty::Ty;
|
2024-07-29 08:13:50 +10:00
|
|
|
use rustc_span::symbol::Ident;
|
|
|
|
use rustc_span::{Span, Symbol};
|
|
|
|
|
|
|
|
use crate::fluent_generated as fluent;
|
2023-01-31 12:23:26 +00:00
|
|
|
mod pattern_types;
|
|
|
|
pub use pattern_types::*;
|
2024-07-05 08:59:31 +00:00
|
|
|
pub mod wrong_number_of_generic_args;
|
2020-08-27 20:09:22 +10:00
|
|
|
|
2024-04-04 12:54:56 -04:00
|
|
|
mod precise_captures;
|
|
|
|
pub(crate) use precise_captures::*;
|
|
|
|
|
2023-11-24 09:53:10 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_ambiguous_assoc_item)]
|
|
|
|
pub struct AmbiguousAssocItem<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub assoc_kind: &'static str,
|
|
|
|
pub assoc_name: Ident,
|
2024-06-14 12:28:23 +02:00
|
|
|
pub qself: &'a str,
|
2023-11-24 09:53:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_assoc_kind_mismatch)]
|
|
|
|
pub struct AssocKindMismatch {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub expected: &'static str,
|
|
|
|
pub got: &'static str,
|
|
|
|
#[label(hir_analysis_expected_because_label)]
|
|
|
|
pub expected_because_label: Option<Span>,
|
|
|
|
pub assoc_kind: &'static str,
|
|
|
|
#[note]
|
|
|
|
pub def_span: Span,
|
|
|
|
#[label(hir_analysis_bound_on_assoc_const_label)]
|
|
|
|
pub bound_on_assoc_const_label: Option<Span>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub wrap_in_braces_sugg: Option<AssocKindMismatchWrapInBracesSugg>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[multipart_suggestion(
|
|
|
|
hir_analysis_assoc_kind_mismatch_wrap_in_braces_sugg,
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
pub struct AssocKindMismatchWrapInBracesSugg {
|
|
|
|
#[suggestion_part(code = "{{ ")]
|
|
|
|
pub lo: Span,
|
|
|
|
#[suggestion_part(code = " }}")]
|
|
|
|
pub hi: Span,
|
|
|
|
}
|
|
|
|
|
2024-06-04 16:47:23 +02:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_assoc_item_is_private, code = E0624)]
|
|
|
|
pub struct AssocItemIsPrivate {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub kind: &'static str,
|
|
|
|
pub name: Ident,
|
|
|
|
#[label(hir_analysis_defined_here_label)]
|
|
|
|
pub defined_here_label: Span,
|
|
|
|
}
|
|
|
|
|
2023-11-24 09:53:10 +01:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_assoc_item_not_found, code = E0220)]
|
2023-11-24 09:53:10 +01:00
|
|
|
pub struct AssocItemNotFound<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub assoc_name: Ident,
|
|
|
|
pub assoc_kind: &'static str,
|
2024-06-14 12:28:23 +02:00
|
|
|
pub qself: &'a str,
|
2023-11-24 09:53:10 +01:00
|
|
|
#[subdiagnostic]
|
|
|
|
pub label: Option<AssocItemNotFoundLabel<'a>>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sugg: Option<AssocItemNotFoundSugg<'a>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
pub enum AssocItemNotFoundLabel<'a> {
|
|
|
|
#[label(hir_analysis_assoc_item_not_found_label)]
|
|
|
|
NotFound {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
#[label(hir_analysis_assoc_item_not_found_found_in_other_trait_label)]
|
|
|
|
FoundInOtherTrait {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
assoc_kind: &'static str,
|
|
|
|
trait_name: &'a str,
|
|
|
|
suggested_name: Symbol,
|
|
|
|
identically_named: bool,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
|
|
|
|
pub enum AssocItemNotFoundSugg<'a> {
|
|
|
|
#[suggestion(
|
|
|
|
hir_analysis_assoc_item_not_found_similar_sugg,
|
|
|
|
code = "{suggested_name}",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
Similar {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
assoc_kind: &'static str,
|
|
|
|
suggested_name: Symbol,
|
|
|
|
},
|
|
|
|
#[suggestion(
|
|
|
|
hir_analysis_assoc_item_not_found_similar_in_other_trait_sugg,
|
|
|
|
code = "{suggested_name}",
|
|
|
|
style = "verbose",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
SimilarInOtherTrait {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
assoc_kind: &'static str,
|
|
|
|
suggested_name: Symbol,
|
|
|
|
},
|
2024-06-14 12:38:21 +02:00
|
|
|
#[multipart_suggestion(
|
|
|
|
hir_analysis_assoc_item_not_found_similar_in_other_trait_qpath_sugg,
|
2024-06-15 11:08:12 +02:00
|
|
|
style = "verbose"
|
2024-06-14 12:38:21 +02:00
|
|
|
)]
|
|
|
|
SimilarInOtherTraitQPath {
|
|
|
|
#[suggestion_part(code = "<")]
|
|
|
|
lo: Span,
|
2024-06-15 11:08:12 +02:00
|
|
|
#[suggestion_part(code = " as {trait_ref}>")]
|
2024-06-14 12:38:21 +02:00
|
|
|
mi: Span,
|
|
|
|
#[suggestion_part(code = "{suggested_name}")]
|
|
|
|
hi: Option<Span>,
|
2024-06-15 11:08:12 +02:00
|
|
|
trait_ref: String,
|
2024-06-14 12:38:21 +02:00
|
|
|
suggested_name: Symbol,
|
|
|
|
identically_named: bool,
|
2024-06-15 11:08:12 +02:00
|
|
|
#[applicability]
|
|
|
|
applicability: Applicability,
|
2024-06-14 12:38:21 +02:00
|
|
|
},
|
2024-06-10 03:38:09 +02:00
|
|
|
#[suggestion(
|
|
|
|
hir_analysis_assoc_item_not_found_other_sugg,
|
|
|
|
code = "{suggested_name}",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
2023-11-24 09:53:10 +01:00
|
|
|
Other {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
2024-06-14 12:28:23 +02:00
|
|
|
qself: &'a str,
|
2023-11-24 09:53:10 +01:00
|
|
|
assoc_kind: &'static str,
|
|
|
|
suggested_name: Symbol,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_unrecognized_atomic_operation, code = E0092)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct UnrecognizedAtomicOperation<'a> {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
pub op: &'a str,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_wrong_number_of_generic_arguments_to_intrinsic, code = E0094)]
|
2021-07-01 13:52:44 +02:00
|
|
|
pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
pub found: usize,
|
|
|
|
pub expected: usize,
|
2021-06-08 20:38:43 +02:00
|
|
|
pub descr: &'a str,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_unrecognized_intrinsic_function, code = E0093)]
|
2024-02-17 15:26:45 -08:00
|
|
|
#[help]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct UnrecognizedIntrinsicFunction {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
pub name: Symbol,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_lifetimes_or_bounds_mismatch_on_trait, code = E0195)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct LifetimesOrBoundsMismatchOnTrait {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-10-13 10:13:02 +01:00
|
|
|
#[label(hir_analysis_generics_label)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub generics_span: Option<Span>,
|
2022-10-13 10:13:02 +01:00
|
|
|
#[label(hir_analysis_where_label)]
|
2022-11-28 00:03:57 -08:00
|
|
|
pub where_span: Option<Span>,
|
2022-10-13 10:13:02 +01:00
|
|
|
#[label(hir_analysis_bounds_label)]
|
2022-11-28 00:03:57 -08:00
|
|
|
pub bounds_span: Vec<Span>,
|
2020-08-27 20:09:22 +10:00
|
|
|
pub item_kind: &'static str,
|
|
|
|
pub ident: Ident,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_drop_impl_on_wrong_item, code = E0120)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct DropImplOnWrongItem {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
2020-08-27 20:00:21 +10:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2024-01-04 21:56:45 +08:00
|
|
|
pub enum FieldAlreadyDeclared {
|
|
|
|
#[diag(hir_analysis_field_already_declared, code = E0124)]
|
|
|
|
NotNested {
|
|
|
|
field_name: Symbol,
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
span: Span,
|
|
|
|
#[label(hir_analysis_previous_decl_label)]
|
|
|
|
prev_span: Span,
|
|
|
|
},
|
|
|
|
#[diag(hir_analysis_field_already_declared_current_nested)]
|
|
|
|
CurrentNested {
|
|
|
|
field_name: Symbol,
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
span: Span,
|
|
|
|
#[note(hir_analysis_nested_field_decl_note)]
|
|
|
|
nested_field_span: Span,
|
2024-01-29 15:08:11 +08:00
|
|
|
#[subdiagnostic]
|
|
|
|
help: FieldAlreadyDeclaredNestedHelp,
|
2024-01-04 21:56:45 +08:00
|
|
|
#[label(hir_analysis_previous_decl_label)]
|
|
|
|
prev_span: Span,
|
|
|
|
},
|
|
|
|
#[diag(hir_analysis_field_already_declared_previous_nested)]
|
|
|
|
PreviousNested {
|
|
|
|
field_name: Symbol,
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
span: Span,
|
|
|
|
#[label(hir_analysis_previous_decl_label)]
|
|
|
|
prev_span: Span,
|
|
|
|
#[note(hir_analysis_previous_nested_field_decl_note)]
|
|
|
|
prev_nested_field_span: Span,
|
2024-01-29 15:08:11 +08:00
|
|
|
#[subdiagnostic]
|
|
|
|
prev_help: FieldAlreadyDeclaredNestedHelp,
|
2024-01-04 21:56:45 +08:00
|
|
|
},
|
|
|
|
#[diag(hir_analysis_field_already_declared_both_nested)]
|
|
|
|
BothNested {
|
|
|
|
field_name: Symbol,
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
span: Span,
|
|
|
|
#[note(hir_analysis_nested_field_decl_note)]
|
|
|
|
nested_field_span: Span,
|
2024-01-29 15:08:11 +08:00
|
|
|
#[subdiagnostic]
|
|
|
|
help: FieldAlreadyDeclaredNestedHelp,
|
2024-01-04 21:56:45 +08:00
|
|
|
#[label(hir_analysis_previous_decl_label)]
|
|
|
|
prev_span: Span,
|
|
|
|
#[note(hir_analysis_previous_nested_field_decl_note)]
|
|
|
|
prev_nested_field_span: Span,
|
2024-01-29 15:08:11 +08:00
|
|
|
#[subdiagnostic]
|
|
|
|
prev_help: FieldAlreadyDeclaredNestedHelp,
|
2024-01-04 21:56:45 +08:00
|
|
|
},
|
2020-08-27 20:00:21 +10:00
|
|
|
}
|
2020-08-27 20:09:22 +10:00
|
|
|
|
2024-01-29 15:08:11 +08:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[help(hir_analysis_field_already_declared_nested_help)]
|
|
|
|
pub struct FieldAlreadyDeclaredNestedHelp {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_copy_impl_on_type_with_dtor, code = E0184)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct CopyImplOnTypeWithDtor {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_multiple_relaxed_default_bounds, code = E0203)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct MultipleRelaxedDefaultBounds {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2023-10-30 17:47:07 +00:00
|
|
|
pub spans: Vec<Span>,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_copy_impl_on_non_adt, code = E0206)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct CopyImplOnNonAdt {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2024-07-14 12:50:41 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_const_param_ty_impl_on_unsized)]
|
|
|
|
pub struct ConstParamTyImplOnUnsized {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-02-17 13:44:35 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_const_param_ty_impl_on_non_adt)]
|
|
|
|
pub struct ConstParamTyImplOnNonAdt {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_trait_object_declared_with_no_traits, code = E0224)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct TraitObjectDeclaredWithNoTraits {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-10-13 10:13:02 +01:00
|
|
|
#[label(hir_analysis_alias_span)]
|
2022-05-09 19:03:37 +02:00
|
|
|
pub trait_alias_span: Option<Span>,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_ambiguous_lifetime_bound, code = E0227)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct AmbiguousLifetimeBound {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2024-05-27 23:53:46 +02:00
|
|
|
#[diag(hir_analysis_assoc_item_constraints_not_allowed_here, code = E0229)]
|
|
|
|
pub struct AssocItemConstraintsNotAllowedHere {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2023-03-09 20:42:45 +13:00
|
|
|
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub fn_trait_expansion: Option<ParenthesizedFnTraitExpansion>,
|
|
|
|
}
|
|
|
|
|
2023-12-28 18:51:53 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_param_in_ty_of_assoc_const_binding)]
|
|
|
|
pub(crate) struct ParamInTyOfAssocConstBinding<'tcx> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub assoc_const: Ident,
|
|
|
|
pub param_name: Symbol,
|
|
|
|
pub param_def_kind: &'static str,
|
|
|
|
pub param_category: &'static str,
|
|
|
|
#[label(hir_analysis_param_defined_here_label)]
|
|
|
|
pub param_defined_here_label: Option<Span>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub ty_note: Option<TyOfAssocConstBindingNote<'tcx>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic, Clone, Copy)]
|
|
|
|
#[note(hir_analysis_ty_of_assoc_const_binding_note)]
|
|
|
|
pub(crate) struct TyOfAssocConstBindingNote<'tcx> {
|
|
|
|
pub assoc_const: Ident,
|
|
|
|
pub ty: Ty<'tcx>,
|
|
|
|
}
|
|
|
|
|
2024-01-10 02:11:25 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_escaping_bound_var_in_ty_of_assoc_const_binding)]
|
|
|
|
pub(crate) struct EscapingBoundVarInTyOfAssocConstBinding<'tcx> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub assoc_const: Ident,
|
|
|
|
pub var_name: Symbol,
|
|
|
|
pub var_def_kind: &'static str,
|
|
|
|
#[label(hir_analysis_var_defined_here_label)]
|
|
|
|
pub var_defined_here_label: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub ty_note: Option<TyOfAssocConstBindingNote<'tcx>>,
|
|
|
|
}
|
|
|
|
|
2023-03-09 20:42:45 +13:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[help(hir_analysis_parenthesized_fn_trait_expansion)]
|
|
|
|
pub struct ParenthesizedFnTraitExpansion {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
|
|
|
|
pub expanded_type: String,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_typeof_reserved_keyword_used, code = E0516)]
|
2022-04-07 22:46:53 +04:00
|
|
|
pub struct TypeofReservedKeywordUsed<'tcx> {
|
|
|
|
pub ty: Ty<'tcx>,
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-10-22 15:48:55 +02:00
|
|
|
#[suggestion(style = "verbose", code = "{ty}")]
|
2022-04-07 22:46:53 +04:00
|
|
|
pub opt_sugg: Option<(Span, Applicability)>,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_value_of_associated_struct_already_specified, code = E0719)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct ValueOfAssociatedStructAlreadySpecified {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-10-13 10:13:02 +01:00
|
|
|
#[label(hir_analysis_previous_bound_label)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub prev_span: Span,
|
|
|
|
pub item_name: Ident,
|
|
|
|
pub def_path: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 11:07:54 +02:00
|
|
|
#[diag(hir_analysis_unconstrained_opaque_type)]
|
2022-05-04 07:27:12 +01:00
|
|
|
#[note]
|
|
|
|
pub struct UnconstrainedOpaqueType {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: Symbol,
|
2022-10-22 03:09:49 +00:00
|
|
|
pub what: &'static str,
|
2022-05-04 07:27:12 +01:00
|
|
|
}
|
2022-05-06 03:46:12 +01:00
|
|
|
|
2023-06-15 09:41:14 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_tait_forward_compat)]
|
|
|
|
#[note]
|
|
|
|
pub struct TaitForwardCompat {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[note]
|
|
|
|
pub item_span: Span,
|
|
|
|
}
|
|
|
|
|
2024-06-10 16:17:38 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_tait_forward_compat2)]
|
|
|
|
#[note]
|
|
|
|
pub struct TaitForwardCompat2 {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[note(hir_analysis_opaque)]
|
|
|
|
pub opaque_type_span: Span,
|
|
|
|
pub opaque_type: String,
|
|
|
|
}
|
|
|
|
|
2022-09-05 17:26:57 -04:00
|
|
|
pub struct MissingTypeParams {
|
2022-05-07 07:32:01 +01:00
|
|
|
pub span: Span,
|
|
|
|
pub def_span: Span,
|
2022-09-05 17:26:57 -04:00
|
|
|
pub span_snippet: Option<String>,
|
2022-07-25 22:40:00 +09:00
|
|
|
pub missing_type_params: Vec<Symbol>,
|
2022-05-07 07:32:01 +01:00
|
|
|
pub empty_generic_args: bool,
|
|
|
|
}
|
|
|
|
|
2024-03-06 11:02:56 +11:00
|
|
|
// Manual implementation of `Diagnostic` to be able to call `span_to_snippet`.
|
|
|
|
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for MissingTypeParams {
|
2022-10-31 16:14:29 +01:00
|
|
|
#[track_caller]
|
2024-06-18 10:35:56 +00:00
|
|
|
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
|
2024-02-23 10:20:45 +11:00
|
|
|
let mut err = Diag::new(dcx, level, fluent::hir_analysis_missing_type_params);
|
2023-12-24 09:08:41 +11:00
|
|
|
err.span(self.span);
|
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-14 10:57:07 +11:00
|
|
|
err.code(E0393);
|
2023-12-24 09:08:41 +11:00
|
|
|
err.arg("parameterCount", self.missing_type_params.len());
|
|
|
|
err.arg(
|
2022-05-07 07:32:01 +01:00
|
|
|
"parameters",
|
|
|
|
self.missing_type_params
|
|
|
|
.iter()
|
2023-07-25 23:17:39 +02:00
|
|
|
.map(|n| format!("`{n}`"))
|
2022-05-07 07:32:01 +01:00
|
|
|
.collect::<Vec<_>>()
|
|
|
|
.join(", "),
|
|
|
|
);
|
|
|
|
|
2022-10-13 10:13:02 +01:00
|
|
|
err.span_label(self.def_span, fluent::hir_analysis_label);
|
2022-05-07 07:32:01 +01:00
|
|
|
|
|
|
|
let mut suggested = false;
|
2022-09-05 17:32:23 -04:00
|
|
|
// Don't suggest setting the type params if there are some already: the order is
|
|
|
|
// tricky to get right and the user will already know what the syntax is.
|
|
|
|
if let Some(snippet) = self.span_snippet
|
|
|
|
&& self.empty_generic_args
|
|
|
|
{
|
2022-05-07 07:32:01 +01:00
|
|
|
if snippet.ends_with('>') {
|
|
|
|
// The user wrote `Trait<'a, T>` or similar. To provide an accurate suggestion
|
|
|
|
// we would have to preserve the right order. For now, as clearly the user is
|
|
|
|
// aware of the syntax, we do nothing.
|
|
|
|
} else {
|
|
|
|
// The user wrote `Iterator`, so we don't have a type we can suggest, but at
|
|
|
|
// least we can clue them to the correct syntax `Iterator<Type>`.
|
2024-07-03 21:02:27 +00:00
|
|
|
err.span_suggestion_verbose(
|
|
|
|
self.span.shrink_to_hi(),
|
2022-10-13 10:13:02 +01:00
|
|
|
fluent::hir_analysis_suggestion,
|
2022-07-25 22:40:00 +09:00
|
|
|
format!(
|
2024-07-03 21:02:27 +00:00
|
|
|
"<{}>",
|
2022-07-25 22:40:00 +09:00
|
|
|
self.missing_type_params
|
|
|
|
.iter()
|
|
|
|
.map(|n| n.to_string())
|
|
|
|
.collect::<Vec<_>>()
|
|
|
|
.join(", ")
|
|
|
|
),
|
2022-05-07 07:32:01 +01:00
|
|
|
Applicability::HasPlaceholders,
|
|
|
|
);
|
|
|
|
suggested = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !suggested {
|
2022-10-13 10:13:02 +01:00
|
|
|
err.span_label(self.span, fluent::hir_analysis_no_suggestion_label);
|
2022-05-07 07:32:01 +01:00
|
|
|
}
|
|
|
|
|
2022-10-13 10:13:02 +01:00
|
|
|
err.note(fluent::hir_analysis_note);
|
2022-05-07 07:32:01 +01:00
|
|
|
err
|
|
|
|
}
|
|
|
|
}
|
2022-05-07 07:50:01 +01:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_manual_implementation, code = E0183)]
|
2022-05-07 07:50:01 +01:00
|
|
|
#[help]
|
|
|
|
pub struct ManualImplementation {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_name: String,
|
|
|
|
}
|
2022-05-07 08:14:48 +01:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2024-02-12 15:39:32 +09:00
|
|
|
#[diag(hir_analysis_generic_args_on_overridden_impl)]
|
|
|
|
pub struct GenericArgsOnOverriddenImpl {
|
2022-05-07 08:14:48 +01:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-08-17 17:47:44 +08:00
|
|
|
|
2022-10-25 18:28:04 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_const_impl_for_non_const_trait)]
|
|
|
|
pub struct ConstImplForNonConstTrait {
|
|
|
|
#[primary_span]
|
|
|
|
pub trait_ref_span: Span,
|
|
|
|
pub trait_name: String,
|
|
|
|
#[suggestion(applicability = "machine-applicable", code = "#[const_trait]")]
|
|
|
|
pub local_trait_span: Option<Span>,
|
|
|
|
#[note]
|
|
|
|
pub marking: (),
|
2022-10-13 10:13:02 +01:00
|
|
|
#[note(hir_analysis_adding)]
|
2022-10-25 18:28:04 +00:00
|
|
|
pub adding: (),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_const_bound_for_non_const_trait)]
|
|
|
|
pub struct ConstBoundForNonConstTrait {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
2023-12-18 17:55:55 +01:00
|
|
|
pub modifier: &'static str,
|
2022-10-25 18:28:04 +00:00
|
|
|
}
|
2022-10-27 21:48:41 +01:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_self_in_impl_self)]
|
|
|
|
pub struct SelfInImplSelf {
|
|
|
|
#[primary_span]
|
2022-10-27 22:18:26 +01:00
|
|
|
pub span: MultiSpan,
|
|
|
|
#[note]
|
|
|
|
pub note: (),
|
2022-10-27 21:48:41 +01:00
|
|
|
}
|
Move linkage type check to HIR analysis and fix semantics issues.
This ensures that the error is printed even for unused variables,
as well as unifying the handling between the LLVM and GCC backends.
This also fixes unusual behavior around exported Rust-defined variables
with linkage attributes. With the previous behavior, it appears to be
impossible to define such a variable such that it can actually be imported
and used by another crate. This is because on the importing side, the
variable is required to be a pointer, but on the exporting side, the
type checker rejects static variables of pointer type because they do
not implement `Sync`. Even if it were possible to import such a type, it
appears that code generation on the importing side would add an unexpected
additional level of pointer indirection, which would break type safety.
This highlighted that the semantics of linkage on Rust-defined variables
is different to linkage on foreign items. As such, we now model the
difference with two different codegen attributes: linkage for Rust-defined
variables, and import_linkage for foreign items.
This change gives semantics to the test
src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was
previously expected to fail to compile. Therefore, convert it into a
test that is expected to successfully compile.
The update to the GCC backend is speculative and untested.
2022-11-23 18:13:30 -08:00
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_linkage_type, code = E0791)]
|
Move linkage type check to HIR analysis and fix semantics issues.
This ensures that the error is printed even for unused variables,
as well as unifying the handling between the LLVM and GCC backends.
This also fixes unusual behavior around exported Rust-defined variables
with linkage attributes. With the previous behavior, it appears to be
impossible to define such a variable such that it can actually be imported
and used by another crate. This is because on the importing side, the
variable is required to be a pointer, but on the exporting side, the
type checker rejects static variables of pointer type because they do
not implement `Sync`. Even if it were possible to import such a type, it
appears that code generation on the importing side would add an unexpected
additional level of pointer indirection, which would break type safety.
This highlighted that the semantics of linkage on Rust-defined variables
is different to linkage on foreign items. As such, we now model the
difference with two different codegen attributes: linkage for Rust-defined
variables, and import_linkage for foreign items.
This change gives semantics to the test
src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was
previously expected to fail to compile. Therefore, convert it into a
test that is expected to successfully compile.
The update to the GCC backend is speculative and untested.
2022-11-23 18:13:30 -08:00
|
|
|
pub(crate) struct LinkageType {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-12-27 00:39:36 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[help]
|
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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_auto_deref_reached_recursion_limit, code = E0055)]
|
2022-12-27 00:39:36 +00:00
|
|
|
pub struct AutoDerefReachedRecursionLimit<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub ty: Ty<'a>,
|
|
|
|
pub suggested_limit: rustc_session::Limit,
|
|
|
|
pub crate_name: Symbol,
|
|
|
|
}
|
2023-02-21 22:27:16 +02:00
|
|
|
|
2023-02-23 01:50:38 +02:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_where_clause_on_main, code = E0646)]
|
2023-02-23 01:50:38 +02:00
|
|
|
pub(crate) struct WhereClauseOnMain {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[label]
|
|
|
|
pub generics_span: Option<Span>,
|
|
|
|
}
|
|
|
|
|
2023-02-21 22:27:16 +02:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_track_caller_on_main)]
|
|
|
|
pub(crate) struct TrackCallerOnMain {
|
|
|
|
#[primary_span]
|
2023-02-26 00:01:44 +02:00
|
|
|
#[suggestion(applicability = "maybe-incorrect", code = "")]
|
2023-02-21 22:27:16 +02:00
|
|
|
pub span: Span,
|
2023-02-26 00:01:44 +02:00
|
|
|
#[label(hir_analysis_track_caller_on_main)]
|
2023-02-21 22:27:16 +02:00
|
|
|
pub annotated: Span,
|
|
|
|
}
|
2023-02-24 23:23:30 +03:00
|
|
|
|
2023-03-02 12:37:32 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_target_feature_on_main)]
|
|
|
|
pub(crate) struct TargetFeatureOnMain {
|
|
|
|
#[primary_span]
|
|
|
|
#[label(hir_analysis_target_feature_on_main)]
|
|
|
|
pub main: Span,
|
|
|
|
}
|
|
|
|
|
2023-02-24 23:23:30 +03:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_start_not_track_caller)]
|
|
|
|
pub(crate) struct StartTrackCaller {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[label]
|
|
|
|
pub start: Span,
|
|
|
|
}
|
|
|
|
|
2023-03-02 14:26:12 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_start_not_target_feature)]
|
|
|
|
pub(crate) struct StartTargetFeature {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[label]
|
|
|
|
pub start: Span,
|
|
|
|
}
|
|
|
|
|
2023-02-24 23:23:30 +03:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_start_not_async, code = E0752)]
|
2023-02-24 23:23:30 +03:00
|
|
|
pub(crate) struct StartAsync {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_start_function_where, code = E0647)]
|
2023-02-24 23:23:30 +03:00
|
|
|
pub(crate) struct StartFunctionWhere {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_start_function_parameters, code = E0132)]
|
2023-02-24 23:23:30 +03:00
|
|
|
pub(crate) struct StartFunctionParameters {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_main_function_return_type_generic, code = E0131)]
|
2023-02-24 23:23:30 +03:00
|
|
|
pub(crate) struct MainFunctionReturnTypeGeneric {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_main_function_async, code = E0752)]
|
2023-02-24 23:23:30 +03:00
|
|
|
pub(crate) struct MainFunctionAsync {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[label]
|
|
|
|
pub asyncness: Option<Span>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_main_function_generic_parameters, code = E0131)]
|
2023-02-24 23:23:30 +03:00
|
|
|
pub(crate) struct MainFunctionGenericParameters {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[label]
|
|
|
|
pub label_span: Option<Span>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_variadic_function_compatible_convention, code = E0045)]
|
2023-02-24 23:23:30 +03:00
|
|
|
pub(crate) struct VariadicFunctionCompatibleConvention<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub conventions: &'a str,
|
|
|
|
}
|
2023-02-28 05:59:54 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
2023-09-02 21:29:27 +00:00
|
|
|
pub(crate) enum CannotCaptureLateBound {
|
|
|
|
#[diag(hir_analysis_cannot_capture_late_bound_ty)]
|
2023-02-28 05:59:54 +00:00
|
|
|
Type {
|
|
|
|
#[primary_span]
|
|
|
|
use_span: Span,
|
|
|
|
#[label]
|
|
|
|
def_span: Span,
|
2023-09-02 21:29:27 +00:00
|
|
|
what: &'static str,
|
2023-02-28 05:59:54 +00:00
|
|
|
},
|
2023-09-02 21:29:27 +00:00
|
|
|
#[diag(hir_analysis_cannot_capture_late_bound_const)]
|
2023-02-28 05:59:54 +00:00
|
|
|
Const {
|
|
|
|
#[primary_span]
|
|
|
|
use_span: Span,
|
|
|
|
#[label]
|
|
|
|
def_span: Span,
|
2023-09-02 21:29:27 +00:00
|
|
|
what: &'static str,
|
|
|
|
},
|
|
|
|
#[diag(hir_analysis_cannot_capture_late_bound_lifetime)]
|
|
|
|
Lifetime {
|
|
|
|
#[primary_span]
|
|
|
|
use_span: Span,
|
|
|
|
#[label]
|
|
|
|
def_span: Span,
|
|
|
|
what: &'static str,
|
2023-02-28 05:59:54 +00:00
|
|
|
},
|
|
|
|
}
|
2023-02-25 20:26:48 +03:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_variances_of)]
|
|
|
|
pub(crate) struct VariancesOf {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
2024-06-19 13:11:18 +02:00
|
|
|
pub variances: String,
|
2023-02-25 20:26:48 +03:00
|
|
|
}
|
|
|
|
|
2023-10-04 23:08:05 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_type_of)]
|
|
|
|
pub(crate) struct TypeOf<'tcx> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
2024-06-19 13:11:18 +02:00
|
|
|
pub ty: Ty<'tcx>,
|
2023-10-04 23:08:05 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 22:26:52 +00:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_invalid_union_field, code = E0740)]
|
2023-03-07 22:26:52 +00:00
|
|
|
pub(crate) struct InvalidUnionField {
|
|
|
|
#[primary_span]
|
|
|
|
pub field_span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sugg: InvalidUnionFieldSuggestion,
|
|
|
|
#[note]
|
|
|
|
pub note: (),
|
|
|
|
}
|
|
|
|
|
2024-02-16 18:48:09 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_invalid_unnamed_field_ty)]
|
|
|
|
pub struct InvalidUnnamedFieldTy {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-03-11 04:10:09 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_return_type_notation_on_non_rpitit)]
|
|
|
|
pub(crate) struct ReturnTypeNotationOnNonRpitit<'tcx> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub ty: Ty<'tcx>,
|
|
|
|
#[label]
|
|
|
|
pub fn_span: Option<Span>,
|
|
|
|
#[note]
|
|
|
|
pub note: (),
|
|
|
|
}
|
|
|
|
|
2023-03-07 22:26:52 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[multipart_suggestion(hir_analysis_invalid_union_field_sugg, applicability = "machine-applicable")]
|
|
|
|
pub(crate) struct InvalidUnionFieldSuggestion {
|
|
|
|
#[suggestion_part(code = "std::mem::ManuallyDrop<")]
|
|
|
|
pub lo: Span,
|
|
|
|
#[suggestion_part(code = ">")]
|
|
|
|
pub hi: Span,
|
|
|
|
}
|
2023-03-11 04:10:09 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_return_type_notation_equality_bound)]
|
|
|
|
pub(crate) struct ReturnTypeNotationEqualityBound {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-04-07 02:04:42 +03:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_placeholder_not_allowed_item_signatures, code = E0121)]
|
2023-04-07 02:04:42 +03:00
|
|
|
pub(crate) struct PlaceholderNotAllowedItemSignatures {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub spans: Vec<Span>,
|
|
|
|
pub kind: 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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_associated_type_trait_uninferred_generic_params, code = E0212)]
|
2023-04-07 02:04:42 +03:00
|
|
|
pub(crate) struct AssociatedTypeTraitUninferredGenericParams {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[suggestion(style = "verbose", applicability = "maybe-incorrect", code = "{bound}")]
|
|
|
|
pub inferred_sugg: Option<Span>,
|
|
|
|
pub bound: String,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub mpart_sugg: Option<AssociatedTypeTraitUninferredGenericParamsMultipartSuggestion>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[multipart_suggestion(
|
|
|
|
hir_analysis_associated_type_trait_uninferred_generic_params_multipart_suggestion,
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
pub(crate) struct AssociatedTypeTraitUninferredGenericParamsMultipartSuggestion {
|
|
|
|
#[suggestion_part(code = "{first}")]
|
|
|
|
pub fspan: Span,
|
|
|
|
pub first: String,
|
|
|
|
#[suggestion_part(code = "{second}")]
|
|
|
|
pub sspan: Span,
|
|
|
|
pub second: 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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_enum_discriminant_overflowed, code = E0370)]
|
2023-04-07 02:04:42 +03:00
|
|
|
#[note]
|
|
|
|
pub(crate) struct EnumDiscriminantOverflowed {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub discr: String,
|
|
|
|
pub item_name: Symbol,
|
|
|
|
pub wrapped_discr: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_paren_sugar_attribute)]
|
|
|
|
#[help]
|
|
|
|
pub(crate) struct ParenSugarAttribute {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_must_implement_one_of_attribute)]
|
|
|
|
pub(crate) struct MustImplementOneOfAttribute {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_must_be_name_of_associated_function)]
|
|
|
|
pub(crate) struct MustBeNameOfAssociatedFunction {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_function_not_have_default_implementation)]
|
|
|
|
pub(crate) struct FunctionNotHaveDefaultImplementation {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[note]
|
|
|
|
pub note_span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_must_implement_not_function)]
|
|
|
|
pub(crate) struct MustImplementNotFunction {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub span_note: MustImplementNotFunctionSpanNote,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub note: MustImplementNotFunctionNote,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[note(hir_analysis_must_implement_not_function_span_note)]
|
|
|
|
pub(crate) struct MustImplementNotFunctionSpanNote {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[note(hir_analysis_must_implement_not_function_note)]
|
|
|
|
pub(crate) struct MustImplementNotFunctionNote {}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_function_not_found_in_trait)]
|
|
|
|
pub(crate) struct FunctionNotFoundInTrait {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_functions_names_duplicated)]
|
|
|
|
#[note]
|
|
|
|
pub(crate) struct FunctionNamesDuplicated {
|
|
|
|
#[primary_span]
|
|
|
|
pub spans: Vec<Span>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_simd_ffi_highly_experimental)]
|
|
|
|
#[help]
|
|
|
|
pub(crate) struct SIMDFFIHighlyExperimental {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub snip: String,
|
|
|
|
}
|
2023-04-14 18:02:41 +03:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
pub enum ImplNotMarkedDefault {
|
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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_impl_not_marked_default, code = E0520)]
|
2023-04-14 18:02:41 +03:00
|
|
|
#[note]
|
|
|
|
Ok {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
span: Span,
|
|
|
|
#[label(hir_analysis_ok_label)]
|
|
|
|
ok_label: Span,
|
|
|
|
ident: Symbol,
|
|
|
|
},
|
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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_impl_not_marked_default_err, code = E0520)]
|
2023-04-14 18:02:41 +03:00
|
|
|
#[note]
|
|
|
|
Err {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
cname: Symbol,
|
|
|
|
ident: Symbol,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_missing_trait_item, code = E0046)]
|
2023-04-14 18:02:41 +03:00
|
|
|
pub(crate) struct MissingTraitItem {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub missing_trait_item_label: Vec<MissingTraitItemLabel>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub missing_trait_item: Vec<MissingTraitItemSuggestion>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub missing_trait_item_none: Vec<MissingTraitItemSuggestionNone>,
|
|
|
|
pub missing_items_msg: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[label(hir_analysis_missing_trait_item_label)]
|
|
|
|
pub(crate) struct MissingTraitItemLabel {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub item: Symbol,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[suggestion(
|
|
|
|
hir_analysis_missing_trait_item_suggestion,
|
|
|
|
style = "tool-only",
|
|
|
|
applicability = "has-placeholders",
|
|
|
|
code = "{code}"
|
|
|
|
)]
|
|
|
|
pub(crate) struct MissingTraitItemSuggestion {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub code: String,
|
|
|
|
pub snippet: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[suggestion(
|
|
|
|
hir_analysis_missing_trait_item_suggestion,
|
|
|
|
style = "hidden",
|
|
|
|
applicability = "has-placeholders",
|
|
|
|
code = "{code}"
|
|
|
|
)]
|
|
|
|
pub(crate) struct MissingTraitItemSuggestionNone {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub code: String,
|
|
|
|
pub snippet: 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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_missing_one_of_trait_item, code = E0046)]
|
2023-04-14 18:02:41 +03:00
|
|
|
pub(crate) struct MissingOneOfTraitItem {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[note]
|
|
|
|
pub note: Option<Span>,
|
|
|
|
pub missing_items_msg: 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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_missing_trait_item_unstable, code = E0046)]
|
2023-04-14 18:02:41 +03:00
|
|
|
#[note]
|
|
|
|
pub(crate) struct MissingTraitItemUnstable {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[note(hir_analysis_some_note)]
|
|
|
|
pub some_note: bool,
|
|
|
|
#[note(hir_analysis_none_note)]
|
|
|
|
pub none_note: bool,
|
|
|
|
pub missing_item_name: Symbol,
|
|
|
|
pub feature: Symbol,
|
|
|
|
pub reason: 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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_transparent_enum_variant, code = E0731)]
|
2023-04-14 18:02:41 +03:00
|
|
|
pub(crate) struct TransparentEnumVariant {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[label(hir_analysis_multi_label)]
|
|
|
|
pub spans: Vec<Span>,
|
|
|
|
#[label(hir_analysis_many_label)]
|
|
|
|
pub many: Option<Span>,
|
|
|
|
pub number: usize,
|
|
|
|
pub 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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_transparent_non_zero_sized_enum, code = E0690)]
|
2023-04-14 18:02:41 +03:00
|
|
|
pub(crate) struct TransparentNonZeroSizedEnum<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[label(hir_analysis_labels)]
|
|
|
|
pub spans: Vec<Span>,
|
|
|
|
pub field_count: usize,
|
|
|
|
pub desc: &'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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_transparent_non_zero_sized, code = E0690)]
|
2023-04-14 18:02:41 +03:00
|
|
|
pub(crate) struct TransparentNonZeroSized<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[label(hir_analysis_labels)]
|
|
|
|
pub spans: Vec<Span>,
|
|
|
|
pub field_count: usize,
|
|
|
|
pub desc: &'a str,
|
|
|
|
}
|
2023-04-10 16:04:14 +01:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_too_large_static)]
|
|
|
|
pub(crate) struct TooLargeStatic {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_specialization_trait)]
|
|
|
|
#[help]
|
|
|
|
pub(crate) struct SpecializationTrait {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_closure_implicit_hrtb)]
|
|
|
|
pub(crate) struct ClosureImplicitHrtb {
|
|
|
|
#[primary_span]
|
|
|
|
pub spans: Vec<Span>,
|
|
|
|
#[label]
|
|
|
|
pub for_sp: Span,
|
|
|
|
}
|
|
|
|
|
2023-05-05 12:54:58 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_empty_specialization)]
|
|
|
|
pub(crate) struct EmptySpecialization {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[note]
|
|
|
|
pub base_impl_span: Span,
|
|
|
|
}
|
|
|
|
|
2023-04-10 16:04:14 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_const_specialize)]
|
|
|
|
pub(crate) struct ConstSpecialize {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_static_specialize)]
|
|
|
|
pub(crate) struct StaticSpecialize {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-04-26 18:22:32 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
pub(crate) enum DropImplPolarity {
|
|
|
|
#[diag(hir_analysis_drop_impl_negative)]
|
|
|
|
Negative {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
#[diag(hir_analysis_drop_impl_reservation)]
|
|
|
|
Reservation {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
}
|
2023-05-01 05:15:45 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
pub(crate) enum ReturnTypeNotationIllegalParam {
|
|
|
|
#[diag(hir_analysis_return_type_notation_illegal_param_type)]
|
|
|
|
Type {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[label]
|
|
|
|
param_span: Span,
|
|
|
|
},
|
|
|
|
#[diag(hir_analysis_return_type_notation_illegal_param_const)]
|
|
|
|
Const {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[label]
|
|
|
|
param_span: Span,
|
|
|
|
},
|
|
|
|
}
|
2023-06-26 18:19:51 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
pub(crate) enum LateBoundInApit {
|
|
|
|
#[diag(hir_analysis_late_bound_type_in_apit)]
|
|
|
|
Type {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[label]
|
|
|
|
param_span: Span,
|
|
|
|
},
|
|
|
|
#[diag(hir_analysis_late_bound_const_in_apit)]
|
|
|
|
Const {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[label]
|
|
|
|
param_span: Span,
|
|
|
|
},
|
2023-06-26 18:36:37 +00:00
|
|
|
#[diag(hir_analysis_late_bound_lifetime_in_apit)]
|
|
|
|
Lifetime {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[label]
|
|
|
|
param_span: Span,
|
|
|
|
},
|
2023-06-26 18:19:51 +00:00
|
|
|
}
|
2023-06-05 17:08:27 +00:00
|
|
|
|
|
|
|
#[derive(LintDiagnostic)]
|
|
|
|
#[diag(hir_analysis_unused_associated_type_bounds)]
|
|
|
|
#[note]
|
|
|
|
pub struct UnusedAssociatedTypeBounds {
|
|
|
|
#[suggestion(code = "")]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2023-08-11 21:27:52 +00:00
|
|
|
|
2023-09-02 04:02:11 +00:00
|
|
|
#[derive(LintDiagnostic)]
|
|
|
|
#[diag(hir_analysis_rpitit_refined)]
|
2023-09-07 00:49:04 +00:00
|
|
|
#[note]
|
2024-02-27 17:08:48 -08:00
|
|
|
#[note(hir_analysis_feedback_note)]
|
2023-09-02 04:02:11 +00:00
|
|
|
pub(crate) struct ReturnPositionImplTraitInTraitRefined<'tcx> {
|
|
|
|
#[suggestion(applicability = "maybe-incorrect", code = "{pre}{return_ty}{post}")]
|
|
|
|
pub impl_return_span: Span,
|
|
|
|
#[label]
|
|
|
|
pub trait_return_span: Option<Span>,
|
|
|
|
#[label(hir_analysis_unmatched_bound_label)]
|
|
|
|
pub unmatched_bound: Option<Span>,
|
|
|
|
|
|
|
|
pub pre: &'static str,
|
|
|
|
pub post: &'static str,
|
|
|
|
pub return_ty: Ty<'tcx>,
|
|
|
|
}
|
|
|
|
|
2023-09-14 21:50:22 +03:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_inherent_ty_outside, code = E0390)]
|
2023-09-14 21:50:22 +03:00
|
|
|
#[help]
|
|
|
|
pub struct InherentTyOutside {
|
|
|
|
#[primary_span]
|
|
|
|
#[help(hir_analysis_span_help)]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-09-13 20:42:56 +03:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
2023-09-13 20:42:56 +03:00
|
|
|
pub struct DispatchFromDynCoercion<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_name: &'a str,
|
|
|
|
#[note(hir_analysis_coercion_between_struct_same_note)]
|
|
|
|
pub note: bool,
|
|
|
|
pub source_path: String,
|
|
|
|
pub target_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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_dispatch_from_dyn_repr, code = E0378)]
|
2023-09-13 20:42:56 +03:00
|
|
|
pub struct DispatchFromDynRepr {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-09-14 21:50:22 +03:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_inherent_ty_outside_relevant, code = E0390)]
|
2023-09-14 21:50:22 +03:00
|
|
|
#[help]
|
|
|
|
pub struct InherentTyOutsideRelevant {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[help(hir_analysis_span_help)]
|
|
|
|
pub help_span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_inherent_ty_outside_new, code = E0116)]
|
2023-09-14 21:50:22 +03:00
|
|
|
#[note]
|
|
|
|
pub struct InherentTyOutsideNew {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_inherent_ty_outside_primitive, code = E0390)]
|
2023-09-14 21:50:22 +03:00
|
|
|
#[help]
|
|
|
|
pub struct InherentTyOutsidePrimitive {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[help(hir_analysis_span_help)]
|
|
|
|
pub help_span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_inherent_primitive_ty, code = E0390)]
|
2023-09-14 21:50:22 +03:00
|
|
|
#[help]
|
|
|
|
pub struct InherentPrimitiveTy<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub note: Option<InherentPrimitiveTyNote<'a>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[note(hir_analysis_inherent_primitive_ty_note)]
|
|
|
|
pub struct InherentPrimitiveTyNote<'a> {
|
|
|
|
pub subty: Ty<'a>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_inherent_dyn, code = E0785)]
|
2023-09-14 21:50:22 +03:00
|
|
|
#[note]
|
|
|
|
pub struct InherentDyn {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_inherent_nominal, code = E0118)]
|
2023-09-14 21:50:22 +03:00
|
|
|
#[note]
|
|
|
|
pub struct InherentNominal {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2023-09-13 20:42:56 +03:00
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_dispatch_from_dyn_zst, code = E0378)]
|
2023-09-13 20:42:56 +03:00
|
|
|
#[note]
|
|
|
|
pub struct DispatchFromDynZST<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: Symbol,
|
|
|
|
pub ty: Ty<'a>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
2023-09-13 20:42:56 +03:00
|
|
|
pub struct DispatchFromDynSingle<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_name: &'a str,
|
|
|
|
#[note(hir_analysis_coercion_between_struct_single_note)]
|
|
|
|
pub note: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_dispatch_from_dyn_multi, code = E0378)]
|
2023-09-13 20:42:56 +03:00
|
|
|
#[note]
|
|
|
|
pub struct DispatchFromDynMulti {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[note(hir_analysis_coercions_note)]
|
|
|
|
pub coercions_note: bool,
|
|
|
|
pub number: usize,
|
|
|
|
pub coercions: 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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_coerce_unsized_may, code = E0376)]
|
2023-09-13 20:42:56 +03:00
|
|
|
pub struct DispatchFromDynStruct<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_coerce_unsized_may, code = E0377)]
|
2023-09-13 20:42:56 +03:00
|
|
|
pub struct DispatchFromDynSame<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_name: &'a str,
|
|
|
|
#[note(hir_analysis_coercion_between_struct_same_note)]
|
|
|
|
pub note: bool,
|
|
|
|
pub source_path: String,
|
|
|
|
pub target_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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_coerce_unsized_may, code = E0374)]
|
2023-09-13 20:42:56 +03:00
|
|
|
pub struct CoerceUnsizedOneField<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_name: &'a str,
|
|
|
|
#[note(hir_analysis_coercion_between_struct_single_note)]
|
|
|
|
pub note: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_coerce_unsized_multi, code = E0375)]
|
2023-09-13 20:42:56 +03:00
|
|
|
#[note]
|
|
|
|
pub struct CoerceUnsizedMulti {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[note(hir_analysis_coercions_note)]
|
|
|
|
pub coercions_note: bool,
|
|
|
|
pub number: usize,
|
|
|
|
pub coercions: 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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
2023-09-13 20:42:56 +03:00
|
|
|
pub struct CoerceUnsizedMay<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_trait_cannot_impl_for_ty, code = E0204)]
|
2023-09-13 20:42:56 +03:00
|
|
|
pub struct TraitCannotImplForTy {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_name: String,
|
|
|
|
#[label]
|
|
|
|
pub label_spans: Vec<Span>,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub notes: Vec<ImplForTyRequires>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[note(hir_analysis_requires_note)]
|
|
|
|
pub struct ImplForTyRequires {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: MultiSpan,
|
|
|
|
pub error_predicate: String,
|
|
|
|
pub trait_name: String,
|
|
|
|
pub ty: String,
|
|
|
|
}
|
2023-10-03 20:17:40 +03:00
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_traits_with_defualt_impl, code = E0321)]
|
2023-10-03 20:17:40 +03:00
|
|
|
#[note]
|
|
|
|
pub struct TraitsWithDefaultImpl<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub traits: String,
|
|
|
|
pub problematic_kind: &'a str,
|
|
|
|
pub self_ty: Ty<'a>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_cross_crate_traits, code = E0321)]
|
2023-10-03 20:17:40 +03:00
|
|
|
pub struct CrossCrateTraits<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub traits: String,
|
|
|
|
pub self_ty: Ty<'a>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_cross_crate_traits_defined, code = E0321)]
|
2023-10-03 20:17:40 +03:00
|
|
|
pub struct CrossCrateTraitsDefined {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub traits: String,
|
|
|
|
}
|
|
|
|
|
2023-10-15 13:40:17 +02:00
|
|
|
// FIXME(fmease): Deduplicate:
|
|
|
|
|
2023-10-03 20:17:40 +03:00
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_ty_param_first_local, code = E0210)]
|
2023-10-03 20:17:40 +03:00
|
|
|
#[note]
|
2023-10-15 13:40:17 +02:00
|
|
|
pub struct TyParamFirstLocal<'tcx> {
|
2023-10-03 20:17:40 +03:00
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[note(hir_analysis_case_note)]
|
|
|
|
pub note: (),
|
2023-10-15 13:40:17 +02:00
|
|
|
pub param: Symbol,
|
|
|
|
pub local_type: Ty<'tcx>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(LintDiagnostic)]
|
|
|
|
#[diag(hir_analysis_ty_param_first_local, code = E0210)]
|
|
|
|
#[note]
|
|
|
|
pub struct TyParamFirstLocalLint<'tcx> {
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[note(hir_analysis_case_note)]
|
|
|
|
pub note: (),
|
|
|
|
pub param: Symbol,
|
|
|
|
pub local_type: Ty<'tcx>,
|
2023-10-03 20:17:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_ty_param_some, code = E0210)]
|
2023-10-03 20:17:40 +03:00
|
|
|
#[note]
|
2023-10-15 13:40:17 +02:00
|
|
|
pub struct TyParamSome {
|
2023-10-03 20:17:40 +03:00
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[note(hir_analysis_only_note)]
|
|
|
|
pub note: (),
|
2023-10-15 13:40:17 +02:00
|
|
|
pub param: Symbol,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(LintDiagnostic)]
|
|
|
|
#[diag(hir_analysis_ty_param_some, code = E0210)]
|
|
|
|
#[note]
|
|
|
|
pub struct TyParamSomeLint {
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[note(hir_analysis_only_note)]
|
|
|
|
pub note: (),
|
|
|
|
pub param: Symbol,
|
2023-10-03 20:17:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
2024-03-29 22:23:10 -04:00
|
|
|
pub enum OnlyCurrentTraits {
|
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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_only_current_traits_outside, code = E0117)]
|
2023-10-03 20:17:40 +03:00
|
|
|
Outside {
|
|
|
|
#[primary_span]
|
|
|
|
#[label(hir_analysis_only_current_traits_label)]
|
2024-08-11 10:13:50 +00:00
|
|
|
#[label(hir_analysis_only_current_traits_label_more_info)]
|
2023-10-03 20:17:40 +03:00
|
|
|
span: Span,
|
|
|
|
#[note(hir_analysis_only_current_traits_note)]
|
|
|
|
note: (),
|
|
|
|
},
|
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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_only_current_traits_primitive, code = E0117)]
|
2023-10-03 20:17:40 +03:00
|
|
|
Primitive {
|
|
|
|
#[primary_span]
|
|
|
|
#[label(hir_analysis_only_current_traits_label)]
|
2024-08-11 10:13:50 +00:00
|
|
|
#[label(hir_analysis_only_current_traits_label_more_info)]
|
2023-10-03 20:17:40 +03:00
|
|
|
span: Span,
|
|
|
|
#[note(hir_analysis_only_current_traits_note)]
|
|
|
|
note: (),
|
|
|
|
},
|
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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_only_current_traits_arbitrary, code = E0117)]
|
2023-10-03 20:17:40 +03:00
|
|
|
Arbitrary {
|
|
|
|
#[primary_span]
|
|
|
|
#[label(hir_analysis_only_current_traits_label)]
|
2024-08-11 10:13:50 +00:00
|
|
|
#[label(hir_analysis_only_current_traits_label_more_info)]
|
2023-10-03 20:17:40 +03:00
|
|
|
span: Span,
|
|
|
|
#[note(hir_analysis_only_current_traits_note)]
|
|
|
|
note: (),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[label(hir_analysis_only_current_traits_opaque)]
|
|
|
|
pub struct OnlyCurrentTraitsOpaque {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[label(hir_analysis_only_current_traits_foreign)]
|
|
|
|
pub struct OnlyCurrentTraitsForeign {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[label(hir_analysis_only_current_traits_name)]
|
|
|
|
pub struct OnlyCurrentTraitsName<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: &'a str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[label(hir_analysis_only_current_traits_pointer)]
|
|
|
|
pub struct OnlyCurrentTraitsPointer<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub pointer: Ty<'a>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[label(hir_analysis_only_current_traits_ty)]
|
|
|
|
pub struct OnlyCurrentTraitsTy<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub ty: Ty<'a>,
|
|
|
|
}
|
|
|
|
|
2024-03-29 21:21:41 -04:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[label(hir_analysis_only_current_traits_adt)]
|
|
|
|
pub struct OnlyCurrentTraitsAdt {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: String,
|
|
|
|
}
|
|
|
|
|
2023-10-03 20:17:40 +03:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[multipart_suggestion(
|
|
|
|
hir_analysis_only_current_traits_pointer_sugg,
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
pub struct OnlyCurrentTraitsPointerSugg<'a> {
|
|
|
|
#[suggestion_part(code = "WrapperType")]
|
|
|
|
pub wrapper_span: Span,
|
|
|
|
#[suggestion_part(code = "struct WrapperType(*{mut_key}{ptr_ty});\n\n")]
|
|
|
|
pub struct_span: Span,
|
|
|
|
pub mut_key: &'a str,
|
|
|
|
pub ptr_ty: Ty<'a>,
|
|
|
|
}
|
2023-12-22 14:56:20 +03:00
|
|
|
|
|
|
|
#[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-14 10:57:07 +11:00
|
|
|
#[diag(hir_analysis_static_mut_ref, code = E0796)]
|
2023-12-22 14:56:20 +03:00
|
|
|
#[note]
|
2024-02-17 22:01:56 +03:00
|
|
|
pub struct StaticMutRef<'a> {
|
2023-12-22 14:56:20 +03:00
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
2024-07-11 20:12:48 +00:00
|
|
|
pub sugg: MutRefSugg,
|
2024-02-17 22:01:56 +03:00
|
|
|
pub shared: &'a str,
|
2023-12-22 14:56:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2024-07-11 20:12:48 +00:00
|
|
|
pub enum MutRefSugg {
|
|
|
|
#[multipart_suggestion(
|
2023-12-22 14:56:20 +03:00
|
|
|
hir_analysis_suggestion,
|
|
|
|
style = "verbose",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
Shared {
|
2024-07-11 20:12:48 +00:00
|
|
|
#[suggestion_part(code = "addr_of!(")]
|
|
|
|
lo: Span,
|
|
|
|
#[suggestion_part(code = ")")]
|
|
|
|
hi: Span,
|
2023-12-22 14:56:20 +03:00
|
|
|
},
|
2024-07-11 20:12:48 +00:00
|
|
|
#[multipart_suggestion(
|
2023-12-22 14:56:20 +03:00
|
|
|
hir_analysis_suggestion_mut,
|
|
|
|
style = "verbose",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
Mut {
|
2024-07-11 20:12:48 +00:00
|
|
|
#[suggestion_part(code = "addr_of_mut!(")]
|
|
|
|
lo: Span,
|
|
|
|
#[suggestion_part(code = ")")]
|
|
|
|
hi: Span,
|
2023-12-22 14:56:20 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// STATIC_MUT_REF lint
|
|
|
|
#[derive(LintDiagnostic)]
|
2024-02-17 22:01:56 +03:00
|
|
|
#[diag(hir_analysis_static_mut_refs_lint)]
|
2023-12-22 14:56:20 +03:00
|
|
|
#[note]
|
2024-02-17 22:01:56 +03:00
|
|
|
#[note(hir_analysis_why_note)]
|
2023-12-22 14:56:20 +03:00
|
|
|
pub struct RefOfMutStatic<'a> {
|
2024-02-17 22:01:56 +03:00
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
2023-12-22 14:56:20 +03:00
|
|
|
#[subdiagnostic]
|
2024-07-11 20:12:48 +00:00
|
|
|
pub sugg: MutRefSugg,
|
2024-02-17 22:01:56 +03:00
|
|
|
pub shared: &'a str,
|
2023-12-22 14:56:20 +03:00
|
|
|
}
|
|
|
|
|
2023-11-26 15:57:31 +03:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_not_supported_delegation)]
|
|
|
|
pub struct NotSupportedDelegation<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub descr: &'a str,
|
|
|
|
#[label]
|
|
|
|
pub callee_span: Span,
|
|
|
|
}
|
2024-02-01 15:58:07 +01:00
|
|
|
|
2024-01-18 17:20:39 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_method_should_return_future)]
|
|
|
|
pub struct MethodShouldReturnFuture {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub method_name: Symbol,
|
|
|
|
#[note]
|
|
|
|
pub trait_item_span: Option<Span>,
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:58:07 +01:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_unused_generic_parameter)]
|
|
|
|
pub(crate) struct UnusedGenericParameter {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub param_name: Ident,
|
|
|
|
pub param_def_kind: &'static str,
|
2024-07-17 18:05:21 -04:00
|
|
|
#[label(hir_analysis_usage_spans)]
|
|
|
|
pub usage_spans: Vec<Span>,
|
2024-02-01 15:58:07 +01:00
|
|
|
#[subdiagnostic]
|
|
|
|
pub help: UnusedGenericParameterHelp,
|
|
|
|
#[help(hir_analysis_const_param_help)]
|
|
|
|
pub const_param_help: Option<()>,
|
|
|
|
}
|
|
|
|
|
2024-07-17 15:56:16 -04:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_recursive_generic_parameter)]
|
|
|
|
pub(crate) struct RecursiveGenericParameter {
|
|
|
|
#[primary_span]
|
|
|
|
pub spans: Vec<Span>,
|
|
|
|
#[label]
|
|
|
|
pub param_span: Span,
|
|
|
|
pub param_name: Ident,
|
|
|
|
pub param_def_kind: &'static str,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub help: UnusedGenericParameterHelp,
|
|
|
|
#[note]
|
|
|
|
pub note: (),
|
|
|
|
}
|
|
|
|
|
2024-02-01 15:58:07 +01:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
pub(crate) enum UnusedGenericParameterHelp {
|
|
|
|
#[help(hir_analysis_unused_generic_parameter_adt_help)]
|
|
|
|
Adt { param_name: Ident, phantom_data: String },
|
|
|
|
#[help(hir_analysis_unused_generic_parameter_adt_no_phantom_data_help)]
|
|
|
|
AdtNoPhantomData { param_name: Ident },
|
|
|
|
#[help(hir_analysis_unused_generic_parameter_ty_alias_help)]
|
|
|
|
TyAlias { param_name: Ident },
|
|
|
|
}
|
2024-01-06 18:22:37 +08:00
|
|
|
|
2024-07-19 14:21:30 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_unconstrained_generic_parameter)]
|
|
|
|
pub(crate) struct UnconstrainedGenericParameter {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub param_name: Symbol,
|
|
|
|
pub param_def_kind: &'static str,
|
|
|
|
#[note(hir_analysis_const_param_note)]
|
|
|
|
pub const_param_note: Option<()>,
|
|
|
|
#[note(hir_analysis_const_param_note2)]
|
|
|
|
pub const_param_note2: Option<()>,
|
|
|
|
}
|
|
|
|
|
2024-01-06 18:22:37 +08:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
pub enum UnnamedFieldsRepr<'a> {
|
|
|
|
#[diag(hir_analysis_unnamed_fields_repr_missing_repr_c)]
|
|
|
|
MissingReprC {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
span: Span,
|
|
|
|
adt_kind: &'static str,
|
|
|
|
adt_name: Symbol,
|
|
|
|
#[subdiagnostic]
|
|
|
|
unnamed_fields: Vec<UnnamedFieldsReprFieldDefined>,
|
2024-01-29 15:08:11 +08:00
|
|
|
#[suggestion(code = "#[repr(C)]\n")]
|
|
|
|
sugg_span: Span,
|
2024-01-06 18:22:37 +08:00
|
|
|
},
|
|
|
|
#[diag(hir_analysis_unnamed_fields_repr_field_missing_repr_c)]
|
|
|
|
FieldMissingReprC {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
span: Span,
|
|
|
|
#[label(hir_analysis_field_ty_label)]
|
|
|
|
field_ty_span: Span,
|
|
|
|
field_ty: Ty<'a>,
|
2024-01-29 15:08:11 +08:00
|
|
|
field_adt_kind: &'static str,
|
|
|
|
#[suggestion(code = "#[repr(C)]\n")]
|
|
|
|
sugg_span: Span,
|
2024-01-06 18:22:37 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[note(hir_analysis_unnamed_fields_repr_field_defined)]
|
|
|
|
pub struct UnnamedFieldsReprFieldDefined {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2024-03-07 15:44:07 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_opaque_captures_higher_ranked_lifetime, code = E0657)]
|
|
|
|
pub struct OpaqueCapturesHigherRankedLifetime {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[label]
|
|
|
|
pub label: Option<Span>,
|
|
|
|
#[note]
|
|
|
|
pub decl_span: Span,
|
|
|
|
pub bad_place: &'static str,
|
|
|
|
}
|
2023-02-02 13:57:36 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_pattern_type_non_const_range)]
|
|
|
|
pub struct NonConstRange {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2024-04-25 03:11:19 +02:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_invalid_receiver_ty, code = E0307)]
|
|
|
|
#[note]
|
|
|
|
#[help(hir_analysis_invalid_receiver_ty_help)]
|
|
|
|
pub struct InvalidReceiverTy<'tcx> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub receiver_ty: Ty<'tcx>,
|
|
|
|
}
|
2024-06-30 17:08:10 +00:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_effects_without_next_solver)]
|
|
|
|
#[note]
|
|
|
|
#[help]
|
|
|
|
pub struct EffectsWithoutNextSolver;
|
2024-07-17 16:47:03 +02:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_cmse_call_inputs_stack_spill, code = E0798)]
|
|
|
|
#[note]
|
|
|
|
pub struct CmseCallInputsStackSpill {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
2024-07-18 14:32:10 +02:00
|
|
|
pub plural: bool,
|
2024-07-17 16:47:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_cmse_call_output_stack_spill, code = E0798)]
|
2024-07-18 14:32:10 +02:00
|
|
|
#[note(hir_analysis_note1)]
|
|
|
|
#[note(hir_analysis_note2)]
|
2024-07-17 16:47:03 +02:00
|
|
|
pub struct CmseCallOutputStackSpill {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(hir_analysis_cmse_call_generic, code = E0798)]
|
|
|
|
pub struct CmseCallGeneric {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|