2024-02-05 23:35:19 -06:00
|
|
|
use rustc_errors::{
|
2024-03-05 21:00:16 -06:00
|
|
|
codes::*, Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic,
|
2024-02-05 23:35:19 -06:00
|
|
|
};
|
2022-09-18 10:47:31 -05:00
|
|
|
use rustc_macros::{Diagnostic, Subdiagnostic};
|
2022-08-18 11:08:39 -05:00
|
|
|
use rustc_span::{symbol::Ident, Span, Symbol};
|
2022-08-16 15:28:51 -05:00
|
|
|
|
2024-03-06 00:10:39 -06: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_generic_type_with_parentheses, code = E0214)]
|
2022-08-16 15:28:51 -05:00
|
|
|
pub struct GenericTypeWithParentheses {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sub: Option<UseAngleBrackets>,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:14:56 -06:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[multipart_suggestion(ast_lowering_use_angle_brackets, applicability = "maybe-incorrect")]
|
2022-08-16 15:28:51 -05:00
|
|
|
pub struct UseAngleBrackets {
|
2022-10-14 07:10:49 -05:00
|
|
|
#[suggestion_part(code = "<")]
|
2022-08-16 15:28:51 -05:00
|
|
|
pub open_param: Span,
|
2022-10-14 07:10:49 -05:00
|
|
|
#[suggestion_part(code = ">")]
|
2022-08-16 15:28:51 -05:00
|
|
|
pub close_param: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:46:56 -05: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_invalid_abi, code = E0703)]
|
2022-09-08 08:37:15 -05:00
|
|
|
#[note]
|
2022-08-17 09:58:57 -05:00
|
|
|
pub struct InvalidAbi {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub abi: Symbol,
|
2022-09-08 08:37:15 -05:00
|
|
|
pub command: String,
|
|
|
|
#[subdiagnostic]
|
feat: `riscv-interrupt-{m,s}` calling conventions
Similar to prior support added for the mips430, avr, and x86 targets
this change implements the rough equivalent of clang's
[`__attribute__((interrupt))`][clang-attr] for riscv targets, enabling
e.g.
```rust
static mut CNT: usize = 0;
pub extern "riscv-interrupt-m" fn isr_m() {
unsafe {
CNT += 1;
}
}
```
to produce highly effective assembly like:
```asm
pub extern "riscv-interrupt-m" fn isr_m() {
420003a0: 1141 addi sp,sp,-16
unsafe {
CNT += 1;
420003a2: c62a sw a0,12(sp)
420003a4: c42e sw a1,8(sp)
420003a6: 3fc80537 lui a0,0x3fc80
420003aa: 63c52583 lw a1,1596(a0) # 3fc8063c <_ZN12esp_riscv_rt3CNT17hcec3e3a214887d53E.0>
420003ae: 0585 addi a1,a1,1
420003b0: 62b52e23 sw a1,1596(a0)
}
}
420003b4: 4532 lw a0,12(sp)
420003b6: 45a2 lw a1,8(sp)
420003b8: 0141 addi sp,sp,16
420003ba: 30200073 mret
```
(disassembly via `riscv64-unknown-elf-objdump -C -S --disassemble ./esp32c3-hal/target/riscv32imc-unknown-none-elf/release/examples/gpio_interrupt`)
This outcome is superior to hand-coded interrupt routines which, lacking
visibility into any non-assembly body of the interrupt handler, have to
be very conservative and save the [entire CPU state to the stack
frame][full-frame-save]. By instead asking LLVM to only save the
registers that it uses, we defer the decision to the tool with the best
context: it can more accurately account for the cost of spills if it
knows that every additional register used is already at the cost of an
implicit spill.
At the LLVM level, this is apparently [implemented by] marking every
register as "[callee-save]," matching the semantics of an interrupt
handler nicely (it has to leave the CPU state just as it found it after
its `{m|s}ret`).
This approach is not suitable for every interrupt handler, as it makes
no attempt to e.g. save the state in a user-accessible stack frame. For
a full discussion of those challenges and tradeoffs, please refer to
[the interrupt calling conventions RFC][rfc].
Inside rustc, this implementation differs from prior art because LLVM
does not expose the "all-saved" function flavor as a calling convention
directly, instead preferring to use an attribute that allows for
differentiating between "machine-mode" and "superivsor-mode" interrupts.
Finally, some effort has been made to guide those who may not yet be
aware of the differences between machine-mode and supervisor-mode
interrupts as to why no `riscv-interrupt` calling convention is exposed
through rustc, and similarly for why `riscv-interrupt-u` makes no
appearance (as it would complicate future LLVM upgrades).
[clang-attr]: https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v
[full-frame-save]: https://github.com/esp-rs/esp-riscv-rt/blob/9281af2ecffe13e40992917316f36920c26acaf3/src/lib.rs#L440-L469
[implemented by]: https://github.com/llvm/llvm-project/blob/b7fb2a3fec7c187d58a6d338ab512d9173bca987/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp#L61-L67
[callee-save]: https://github.com/llvm/llvm-project/blob/973f1fe7a8591c7af148e573491ab68cc15b6ecf/llvm/lib/Target/RISCV/RISCVCallingConv.td#L30-L37
[rfc]: https://github.com/rust-lang/rfcs/pull/3246
2023-05-23 17:08:23 -05:00
|
|
|
pub explain: Option<InvalidAbiReason>,
|
|
|
|
#[subdiagnostic]
|
2022-09-08 08:37:15 -05:00
|
|
|
pub suggestion: Option<InvalidAbiSuggestion>,
|
|
|
|
}
|
|
|
|
|
feat: `riscv-interrupt-{m,s}` calling conventions
Similar to prior support added for the mips430, avr, and x86 targets
this change implements the rough equivalent of clang's
[`__attribute__((interrupt))`][clang-attr] for riscv targets, enabling
e.g.
```rust
static mut CNT: usize = 0;
pub extern "riscv-interrupt-m" fn isr_m() {
unsafe {
CNT += 1;
}
}
```
to produce highly effective assembly like:
```asm
pub extern "riscv-interrupt-m" fn isr_m() {
420003a0: 1141 addi sp,sp,-16
unsafe {
CNT += 1;
420003a2: c62a sw a0,12(sp)
420003a4: c42e sw a1,8(sp)
420003a6: 3fc80537 lui a0,0x3fc80
420003aa: 63c52583 lw a1,1596(a0) # 3fc8063c <_ZN12esp_riscv_rt3CNT17hcec3e3a214887d53E.0>
420003ae: 0585 addi a1,a1,1
420003b0: 62b52e23 sw a1,1596(a0)
}
}
420003b4: 4532 lw a0,12(sp)
420003b6: 45a2 lw a1,8(sp)
420003b8: 0141 addi sp,sp,16
420003ba: 30200073 mret
```
(disassembly via `riscv64-unknown-elf-objdump -C -S --disassemble ./esp32c3-hal/target/riscv32imc-unknown-none-elf/release/examples/gpio_interrupt`)
This outcome is superior to hand-coded interrupt routines which, lacking
visibility into any non-assembly body of the interrupt handler, have to
be very conservative and save the [entire CPU state to the stack
frame][full-frame-save]. By instead asking LLVM to only save the
registers that it uses, we defer the decision to the tool with the best
context: it can more accurately account for the cost of spills if it
knows that every additional register used is already at the cost of an
implicit spill.
At the LLVM level, this is apparently [implemented by] marking every
register as "[callee-save]," matching the semantics of an interrupt
handler nicely (it has to leave the CPU state just as it found it after
its `{m|s}ret`).
This approach is not suitable for every interrupt handler, as it makes
no attempt to e.g. save the state in a user-accessible stack frame. For
a full discussion of those challenges and tradeoffs, please refer to
[the interrupt calling conventions RFC][rfc].
Inside rustc, this implementation differs from prior art because LLVM
does not expose the "all-saved" function flavor as a calling convention
directly, instead preferring to use an attribute that allows for
differentiating between "machine-mode" and "superivsor-mode" interrupts.
Finally, some effort has been made to guide those who may not yet be
aware of the differences between machine-mode and supervisor-mode
interrupts as to why no `riscv-interrupt` calling convention is exposed
through rustc, and similarly for why `riscv-interrupt-u` makes no
appearance (as it would complicate future LLVM upgrades).
[clang-attr]: https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v
[full-frame-save]: https://github.com/esp-rs/esp-riscv-rt/blob/9281af2ecffe13e40992917316f36920c26acaf3/src/lib.rs#L440-L469
[implemented by]: https://github.com/llvm/llvm-project/blob/b7fb2a3fec7c187d58a6d338ab512d9173bca987/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp#L61-L67
[callee-save]: https://github.com/llvm/llvm-project/blob/973f1fe7a8591c7af148e573491ab68cc15b6ecf/llvm/lib/Target/RISCV/RISCVCallingConv.td#L30-L37
[rfc]: https://github.com/rust-lang/rfcs/pull/3246
2023-05-23 17:08:23 -05:00
|
|
|
pub struct InvalidAbiReason(pub &'static str);
|
|
|
|
|
2024-03-05 21:00:16 -06:00
|
|
|
impl Subdiagnostic for InvalidAbiReason {
|
|
|
|
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
|
Reduce capabilities of `Diagnostic`.
Currently many diagnostic modifier methods are available on both
`Diagnostic` and `DiagnosticBuilder`. This commit removes most of them
from `Diagnostic`. To minimize the diff size, it keeps them within
`diagnostic.rs` but changes the surrounding `impl Diagnostic` block to
`impl DiagnosticBuilder`. (I intend to move things around later, to give
a more sensible code layout.)
`Diagnostic` keeps a few methods that it still needs, like `sub`,
`arg`, and `replace_args`.
The `forward!` macro, which defined two additional methods per call
(e.g. `note` and `with_note`), is replaced by the `with_fn!` macro,
which defines one additional method per call (e.g. `with_note`). It's
now also only used when necessary -- not all modifier methods currently
need a `with_*` form. (New ones can be easily added as necessary.)
All this also requires changing `trait AddToDiagnostic` so its methods
take `DiagnosticBuilder` instead of `Diagnostic`, which leads to many
mechanical changes. `SubdiagnosticMessageOp` gains a type parameter `G`.
There are three subdiagnostics -- `DelayedAtWithoutNewline`,
`DelayedAtWithNewline`, and `InvalidFlushedDelayedDiagnosticLevel` --
that are created within the diagnostics machinery and appended to
external diagnostics. These are handled at the `Diagnostic` level, which
means it's now hard to construct them via `derive(Diagnostic)`, so
instead we construct them by hand. This has no effect on what they look
like when printed.
There are lots of new `allow` markers for `untranslatable_diagnostics`
and `diagnostics_outside_of_impl`. This is because
`#[rustc_lint_diagnostics]` annotations were present on the `Diagnostic`
modifier methods, but missing from the `DiagnosticBuilder` modifier
methods. They're now present.
2024-02-05 23:44:30 -06:00
|
|
|
self,
|
2024-02-22 17:20:45 -06:00
|
|
|
diag: &mut Diag<'_, G>,
|
Reduce capabilities of `Diagnostic`.
Currently many diagnostic modifier methods are available on both
`Diagnostic` and `DiagnosticBuilder`. This commit removes most of them
from `Diagnostic`. To minimize the diff size, it keeps them within
`diagnostic.rs` but changes the surrounding `impl Diagnostic` block to
`impl DiagnosticBuilder`. (I intend to move things around later, to give
a more sensible code layout.)
`Diagnostic` keeps a few methods that it still needs, like `sub`,
`arg`, and `replace_args`.
The `forward!` macro, which defined two additional methods per call
(e.g. `note` and `with_note`), is replaced by the `with_fn!` macro,
which defines one additional method per call (e.g. `with_note`). It's
now also only used when necessary -- not all modifier methods currently
need a `with_*` form. (New ones can be easily added as necessary.)
All this also requires changing `trait AddToDiagnostic` so its methods
take `DiagnosticBuilder` instead of `Diagnostic`, which leads to many
mechanical changes. `SubdiagnosticMessageOp` gains a type parameter `G`.
There are three subdiagnostics -- `DelayedAtWithoutNewline`,
`DelayedAtWithNewline`, and `InvalidFlushedDelayedDiagnosticLevel` --
that are created within the diagnostics machinery and appended to
external diagnostics. These are handled at the `Diagnostic` level, which
means it's now hard to construct them via `derive(Diagnostic)`, so
instead we construct them by hand. This has no effect on what they look
like when printed.
There are lots of new `allow` markers for `untranslatable_diagnostics`
and `diagnostics_outside_of_impl`. This is because
`#[rustc_lint_diagnostics]` annotations were present on the `Diagnostic`
modifier methods, but missing from the `DiagnosticBuilder` modifier
methods. They're now present.
2024-02-05 23:44:30 -06:00
|
|
|
_: F,
|
|
|
|
) {
|
feat: `riscv-interrupt-{m,s}` calling conventions
Similar to prior support added for the mips430, avr, and x86 targets
this change implements the rough equivalent of clang's
[`__attribute__((interrupt))`][clang-attr] for riscv targets, enabling
e.g.
```rust
static mut CNT: usize = 0;
pub extern "riscv-interrupt-m" fn isr_m() {
unsafe {
CNT += 1;
}
}
```
to produce highly effective assembly like:
```asm
pub extern "riscv-interrupt-m" fn isr_m() {
420003a0: 1141 addi sp,sp,-16
unsafe {
CNT += 1;
420003a2: c62a sw a0,12(sp)
420003a4: c42e sw a1,8(sp)
420003a6: 3fc80537 lui a0,0x3fc80
420003aa: 63c52583 lw a1,1596(a0) # 3fc8063c <_ZN12esp_riscv_rt3CNT17hcec3e3a214887d53E.0>
420003ae: 0585 addi a1,a1,1
420003b0: 62b52e23 sw a1,1596(a0)
}
}
420003b4: 4532 lw a0,12(sp)
420003b6: 45a2 lw a1,8(sp)
420003b8: 0141 addi sp,sp,16
420003ba: 30200073 mret
```
(disassembly via `riscv64-unknown-elf-objdump -C -S --disassemble ./esp32c3-hal/target/riscv32imc-unknown-none-elf/release/examples/gpio_interrupt`)
This outcome is superior to hand-coded interrupt routines which, lacking
visibility into any non-assembly body of the interrupt handler, have to
be very conservative and save the [entire CPU state to the stack
frame][full-frame-save]. By instead asking LLVM to only save the
registers that it uses, we defer the decision to the tool with the best
context: it can more accurately account for the cost of spills if it
knows that every additional register used is already at the cost of an
implicit spill.
At the LLVM level, this is apparently [implemented by] marking every
register as "[callee-save]," matching the semantics of an interrupt
handler nicely (it has to leave the CPU state just as it found it after
its `{m|s}ret`).
This approach is not suitable for every interrupt handler, as it makes
no attempt to e.g. save the state in a user-accessible stack frame. For
a full discussion of those challenges and tradeoffs, please refer to
[the interrupt calling conventions RFC][rfc].
Inside rustc, this implementation differs from prior art because LLVM
does not expose the "all-saved" function flavor as a calling convention
directly, instead preferring to use an attribute that allows for
differentiating between "machine-mode" and "superivsor-mode" interrupts.
Finally, some effort has been made to guide those who may not yet be
aware of the differences between machine-mode and supervisor-mode
interrupts as to why no `riscv-interrupt` calling convention is exposed
through rustc, and similarly for why `riscv-interrupt-u` makes no
appearance (as it would complicate future LLVM upgrades).
[clang-attr]: https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v
[full-frame-save]: https://github.com/esp-rs/esp-riscv-rt/blob/9281af2ecffe13e40992917316f36920c26acaf3/src/lib.rs#L440-L469
[implemented by]: https://github.com/llvm/llvm-project/blob/b7fb2a3fec7c187d58a6d338ab512d9173bca987/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp#L61-L67
[callee-save]: https://github.com/llvm/llvm-project/blob/973f1fe7a8591c7af148e573491ab68cc15b6ecf/llvm/lib/Target/RISCV/RISCVCallingConv.td#L30-L37
[rfc]: https://github.com/rust-lang/rfcs/pull/3246
2023-05-23 17:08:23 -05:00
|
|
|
#[allow(rustc::untranslatable_diagnostic)]
|
|
|
|
diag.note(self.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-08 08:37:15 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[suggestion(
|
2022-10-22 04:07:54 -05:00
|
|
|
ast_lowering_invalid_abi_suggestion,
|
2022-09-08 08:37:15 -05:00
|
|
|
code = "{suggestion}",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
pub struct InvalidAbiSuggestion {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub suggestion: String,
|
2022-08-17 09:58:57 -05:00
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_assoc_ty_parentheses)]
|
2022-08-17 09:58:57 -05:00
|
|
|
pub struct AssocTyParentheses {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sub: AssocTyParenthesesSub,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:14:56 -06:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-08-17 09:58:57 -05:00
|
|
|
pub enum AssocTyParenthesesSub {
|
2022-10-22 04:07:54 -05:00
|
|
|
#[multipart_suggestion(ast_lowering_remove_parentheses)]
|
2022-10-14 07:10:49 -05:00
|
|
|
Empty {
|
|
|
|
#[suggestion_part(code = "")]
|
|
|
|
parentheses_span: Span,
|
|
|
|
},
|
2022-10-22 04:07:54 -05:00
|
|
|
#[multipart_suggestion(ast_lowering_use_angle_brackets)]
|
2022-10-14 07:10:49 -05:00
|
|
|
NotEmpty {
|
|
|
|
#[suggestion_part(code = "<")]
|
|
|
|
open_param: Span,
|
|
|
|
#[suggestion_part(code = ">")]
|
|
|
|
close_param: Span,
|
|
|
|
},
|
2022-08-17 09:58:57 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:46:56 -05: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_misplaced_impl_trait, code = E0562)]
|
2024-01-07 11:11:48 -06:00
|
|
|
#[note]
|
2022-08-19 07:55:06 -05:00
|
|
|
pub struct MisplacedImplTrait<'a> {
|
2022-08-17 09:58:57 -05:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
2024-02-22 22:34:39 -06:00
|
|
|
pub position: DiagArgFromDisplay<'a>,
|
2022-08-17 09:58:57 -05:00
|
|
|
}
|
2022-08-17 12:48:25 -05:00
|
|
|
|
2023-02-14 13:15:43 -06:00
|
|
|
#[derive(Diagnostic)]
|
2024-02-06 13:35:57 -06:00
|
|
|
#[diag(ast_lowering_assoc_ty_binding_in_dyn)]
|
|
|
|
pub struct MisplacedAssocTyBinding {
|
2023-02-14 13:15:43 -06:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
2024-02-06 13:48:16 -06:00
|
|
|
#[suggestion(code = " = impl", applicability = "maybe-incorrect", style = "verbose")]
|
|
|
|
pub suggestion: Option<Span>,
|
2023-02-14 13:15:43 -06:00
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_underscore_expr_lhs_assign)]
|
2022-08-17 12:48:25 -05:00
|
|
|
pub struct UnderscoreExprLhsAssign {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_base_expression_double_dot, code = E0797)]
|
2022-08-17 12:48:25 -05:00
|
|
|
pub struct BaseExpressionDoubleDot {
|
|
|
|
#[primary_span]
|
2023-05-26 08:49:01 -05:00
|
|
|
#[suggestion(code = "/* expr */", applicability = "has-placeholders", style = "verbose")]
|
2022-08-17 12:48:25 -05:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_await_only_in_async_fn_and_blocks, code = E0728)]
|
2022-08-17 12:48:25 -05:00
|
|
|
pub struct AwaitOnlyInAsyncFnAndBlocks {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
2023-04-27 12:40:55 -05:00
|
|
|
pub await_kw_span: Span,
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_this_not_async)]
|
2022-08-17 12:48:25 -05:00
|
|
|
pub item_span: Option<Span>,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_coroutine_too_many_parameters, code = E0628)]
|
2023-10-19 11:06:43 -05:00
|
|
|
pub struct CoroutineTooManyParameters {
|
2022-08-17 12:48:25 -05:00
|
|
|
#[primary_span]
|
|
|
|
pub fn_decl_span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_closure_cannot_be_static, code = E0697)]
|
2022-08-17 12:48:25 -05:00
|
|
|
pub struct ClosureCannotBeStatic {
|
|
|
|
#[primary_span]
|
|
|
|
pub fn_decl_span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_functional_record_update_destructuring_assignment)]
|
2023-04-10 15:02:52 -05:00
|
|
|
pub struct FunctionalRecordUpdateDestructuringAssignment {
|
2022-08-17 12:48:25 -05:00
|
|
|
#[primary_span]
|
|
|
|
#[suggestion(code = "", applicability = "machine-applicable")]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_async_coroutines_not_supported, code = E0727)]
|
2023-10-19 11:06:43 -05:00
|
|
|
pub struct AsyncCoroutinesNotSupported {
|
2022-08-17 12:48:25 -05:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-08-17 16:00:33 -05:00
|
|
|
|
2024-03-06 00:10:39 -06: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-13 17:57:07 -06:00
|
|
|
#[diag(ast_lowering_inline_asm_unsupported_target, code = E0472)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct InlineAsmUnsupportedTarget {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_att_syntax_only_x86)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct AttSyntaxOnlyX86 {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_abi_specified_multiple_times)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct AbiSpecifiedMultipleTimes {
|
|
|
|
#[primary_span]
|
|
|
|
pub abi_span: Span,
|
|
|
|
pub prev_name: Symbol,
|
|
|
|
#[label]
|
|
|
|
pub prev_span: Span,
|
|
|
|
#[note]
|
|
|
|
pub equivalent: Option<()>,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_clobber_abi_not_supported)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct ClobberAbiNotSupported {
|
|
|
|
#[primary_span]
|
|
|
|
pub abi_span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:46:56 -05:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-17 16:00:33 -05:00
|
|
|
#[note]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_invalid_abi_clobber_abi)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct InvalidAbiClobberAbi {
|
|
|
|
#[primary_span]
|
|
|
|
pub abi_span: Span,
|
|
|
|
pub supported_abis: String,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_invalid_register)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct InvalidRegister<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub op_span: Span,
|
2022-08-19 07:55:06 -05:00
|
|
|
pub reg: Symbol,
|
|
|
|
pub error: &'a str,
|
2022-08-17 16:00:33 -05:00
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_invalid_register_class)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct InvalidRegisterClass<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub op_span: Span,
|
2022-08-19 07:55:06 -05:00
|
|
|
pub reg_class: Symbol,
|
|
|
|
pub error: &'a str,
|
2022-08-17 16:00:33 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:46:56 -05:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_invalid_asm_template_modifier_reg_class)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct InvalidAsmTemplateModifierRegClass {
|
|
|
|
#[primary_span]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_template_modifier)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub placeholder_span: Span,
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_argument)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub op_span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sub: InvalidAsmTemplateModifierRegClassSub,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub enum InvalidAsmTemplateModifierRegClassSub {
|
2022-10-22 04:07:54 -05:00
|
|
|
#[note(ast_lowering_support_modifiers)]
|
2022-08-17 16:00:33 -05:00
|
|
|
SupportModifier { class_name: Symbol, modifiers: String },
|
2022-10-22 04:07:54 -05:00
|
|
|
#[note(ast_lowering_does_not_support_modifiers)]
|
2022-08-17 16:00:33 -05:00
|
|
|
DoesNotSupportModifier { class_name: Symbol },
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_invalid_asm_template_modifier_const)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct InvalidAsmTemplateModifierConst {
|
|
|
|
#[primary_span]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_template_modifier)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub placeholder_span: Span,
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_argument)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub op_span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_invalid_asm_template_modifier_sym)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct InvalidAsmTemplateModifierSym {
|
|
|
|
#[primary_span]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_template_modifier)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub placeholder_span: Span,
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_argument)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub op_span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2023-12-25 14:53:01 -06:00
|
|
|
#[diag(ast_lowering_invalid_asm_template_modifier_label)]
|
|
|
|
pub struct InvalidAsmTemplateModifierLabel {
|
|
|
|
#[primary_span]
|
|
|
|
#[label(ast_lowering_template_modifier)]
|
|
|
|
pub placeholder_span: Span,
|
|
|
|
#[label(ast_lowering_argument)]
|
|
|
|
pub op_span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_register_class_only_clobber)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct RegisterClassOnlyClobber {
|
|
|
|
#[primary_span]
|
|
|
|
pub op_span: Span,
|
|
|
|
pub reg_class_name: Symbol,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_register_conflict)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub struct RegisterConflict<'a> {
|
|
|
|
#[primary_span]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_register1)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub op_span1: Span,
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_register2)]
|
2022-08-17 16:00:33 -05:00
|
|
|
pub op_span2: Span,
|
|
|
|
pub reg1_name: &'a str,
|
|
|
|
pub reg2_name: &'a str,
|
|
|
|
#[help]
|
|
|
|
pub in_out: Option<Span>,
|
|
|
|
}
|
2022-08-18 11:08:39 -05:00
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-18 11:08:39 -05:00
|
|
|
#[help]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_sub_tuple_binding)]
|
2022-08-18 11:08:39 -05:00
|
|
|
pub struct SubTupleBinding<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
2022-10-22 08:48:55 -05:00
|
|
|
#[suggestion(
|
2022-10-22 04:07:54 -05:00
|
|
|
ast_lowering_sub_tuple_binding_suggestion,
|
2022-10-22 08:48:55 -05:00
|
|
|
style = "verbose",
|
2022-08-18 11:08:39 -05:00
|
|
|
code = "..",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
pub span: Span,
|
|
|
|
pub ident: Ident,
|
|
|
|
pub ident_name: Symbol,
|
|
|
|
pub ctx: &'a str,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_extra_double_dot)]
|
2022-08-18 11:08:39 -05:00
|
|
|
pub struct ExtraDoubleDot<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
2022-10-22 04:07:54 -05:00
|
|
|
#[label(ast_lowering_previously_used_here)]
|
2022-08-18 11:08:39 -05:00
|
|
|
pub prev_span: Span,
|
|
|
|
pub ctx: &'a str,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-18 11:08:39 -05:00
|
|
|
#[note]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_misplaced_double_dot)]
|
2022-08-18 11:08:39 -05:00
|
|
|
pub struct MisplacedDoubleDot {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-08-18 12:30:56 -05:00
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_misplaced_relax_trait_bound)]
|
2022-08-18 12:30:56 -05:00
|
|
|
pub struct MisplacedRelaxTraitBound {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-11-26 18:53:05 -06:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ast_lowering_match_arm_with_no_body)]
|
|
|
|
pub struct MatchArmWithNoBody {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[suggestion(code = " => todo!(),", applicability = "has-placeholders")]
|
|
|
|
pub suggestion: Span,
|
|
|
|
}
|
|
|
|
|
2023-11-26 21:08:09 -06:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ast_lowering_never_pattern_with_body)]
|
|
|
|
pub struct NeverPatternWithBody {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
#[suggestion(code = "", applicability = "maybe-incorrect")]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-11-26 20:47:49 -06:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ast_lowering_never_pattern_with_guard)]
|
|
|
|
pub struct NeverPatternWithGuard {
|
|
|
|
#[primary_span]
|
|
|
|
#[suggestion(code = "", applicability = "maybe-incorrect")]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_arbitrary_expression_in_pattern)]
|
2022-08-18 12:30:56 -05:00
|
|
|
pub struct ArbitraryExpressionInPattern {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-08-26 11:03:41 -05:00
|
|
|
|
2024-03-06 00:10:39 -06:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 04:07:54 -05:00
|
|
|
#[diag(ast_lowering_inclusive_range_with_no_end)]
|
2022-08-26 11:03:41 -05:00
|
|
|
pub struct InclusiveRangeWithNoEnd {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-09-02 10:57:31 -05:00
|
|
|
|
2023-03-10 22:10:09 -06:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
pub enum BadReturnTypeNotation {
|
|
|
|
#[diag(ast_lowering_bad_return_type_notation_inputs)]
|
|
|
|
Inputs {
|
|
|
|
#[primary_span]
|
2023-04-10 17:16:17 -05:00
|
|
|
#[suggestion(code = "()", applicability = "maybe-incorrect")]
|
2023-03-10 22:10:09 -06:00
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
#[diag(ast_lowering_bad_return_type_notation_output)]
|
|
|
|
Output {
|
|
|
|
#[primary_span]
|
|
|
|
#[suggestion(code = "", applicability = "maybe-incorrect")]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
}
|
2023-12-23 01:57:24 -06:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
2024-01-01 12:29:27 -06:00
|
|
|
#[diag(ast_lowering_generic_param_default_in_binder)]
|
|
|
|
pub(crate) struct GenericParamDefaultInBinder {
|
2023-12-23 01:57:24 -06:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2024-01-26 11:33:42 -06:00
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ast_lowering_async_bound_not_on_trait)]
|
|
|
|
pub(crate) struct AsyncBoundNotOnTrait {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub descr: &'static str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ast_lowering_async_bound_only_for_fn_traits)]
|
|
|
|
pub(crate) struct AsyncBoundOnlyForFnTraits {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|