2022-10-14 12:10:49 +00:00
|
|
|
use rustc_errors::DiagnosticArgFromDisplay;
|
2022-09-18 15:47:31 +00:00
|
|
|
use rustc_macros::{Diagnostic, Subdiagnostic};
|
2022-08-18 16:08:39 +00:00
|
|
|
use rustc_span::{symbol::Ident, Span, Symbol};
|
2022-08-16 20:28:51 +00:00
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_generic_type_with_parentheses, code = "E0214")]
|
2022-08-16 20:28:51 +00:00
|
|
|
pub struct GenericTypeWithParentheses {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sub: Option<UseAngleBrackets>,
|
|
|
|
}
|
|
|
|
|
2022-10-14 12:10:49 +00:00
|
|
|
#[derive(Clone, Copy, Subdiagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[multipart_suggestion(ast_lowering_use_angle_brackets, applicability = "maybe-incorrect")]
|
2022-08-16 20:28:51 +00:00
|
|
|
pub struct UseAngleBrackets {
|
2022-10-14 12:10:49 +00:00
|
|
|
#[suggestion_part(code = "<")]
|
2022-08-16 20:28:51 +00:00
|
|
|
pub open_param: Span,
|
2022-10-14 12:10:49 +00:00
|
|
|
#[suggestion_part(code = ">")]
|
2022-08-16 20:28:51 +00:00
|
|
|
pub close_param: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_invalid_abi, code = "E0703")]
|
2022-09-08 13:37:15 +00:00
|
|
|
#[note]
|
2022-08-17 14:58:57 +00:00
|
|
|
pub struct InvalidAbi {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub abi: Symbol,
|
2022-09-08 13:37:15 +00: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 22:08:23 +00:00
|
|
|
pub explain: Option<InvalidAbiReason>,
|
|
|
|
#[subdiagnostic]
|
2022-09-08 13:37:15 +00: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 22:08:23 +00:00
|
|
|
pub struct InvalidAbiReason(pub &'static str);
|
|
|
|
|
|
|
|
impl rustc_errors::AddToDiagnostic for InvalidAbiReason {
|
|
|
|
fn add_to_diagnostic_with<F>(self, diag: &mut rustc_errors::Diagnostic, _: F)
|
|
|
|
where
|
|
|
|
F: Fn(
|
|
|
|
&mut rustc_errors::Diagnostic,
|
|
|
|
rustc_errors::SubdiagnosticMessage,
|
|
|
|
) -> rustc_errors::SubdiagnosticMessage,
|
|
|
|
{
|
|
|
|
#[allow(rustc::untranslatable_diagnostic)]
|
|
|
|
diag.note(self.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-08 13:37:15 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
#[suggestion(
|
2022-10-22 09:07:54 +00:00
|
|
|
ast_lowering_invalid_abi_suggestion,
|
2022-09-08 13:37:15 +00:00
|
|
|
code = "{suggestion}",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
pub struct InvalidAbiSuggestion {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub suggestion: String,
|
2022-08-17 14:58:57 +00:00
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_assoc_ty_parentheses)]
|
2022-08-17 14:58:57 +00:00
|
|
|
pub struct AssocTyParentheses {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sub: AssocTyParenthesesSub,
|
|
|
|
}
|
|
|
|
|
2022-10-14 12:10:49 +00:00
|
|
|
#[derive(Clone, Copy, Subdiagnostic)]
|
2022-08-17 14:58:57 +00:00
|
|
|
pub enum AssocTyParenthesesSub {
|
2022-10-22 09:07:54 +00:00
|
|
|
#[multipart_suggestion(ast_lowering_remove_parentheses)]
|
2022-10-14 12:10:49 +00:00
|
|
|
Empty {
|
|
|
|
#[suggestion_part(code = "")]
|
|
|
|
parentheses_span: Span,
|
|
|
|
},
|
2022-10-22 09:07:54 +00:00
|
|
|
#[multipart_suggestion(ast_lowering_use_angle_brackets)]
|
2022-10-14 12:10:49 +00:00
|
|
|
NotEmpty {
|
|
|
|
#[suggestion_part(code = "<")]
|
|
|
|
open_param: Span,
|
|
|
|
#[suggestion_part(code = ">")]
|
|
|
|
close_param: Span,
|
|
|
|
},
|
2022-08-17 14:58:57 +00:00
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_misplaced_impl_trait, code = "E0562")]
|
2022-08-19 12:55:06 +00:00
|
|
|
pub struct MisplacedImplTrait<'a> {
|
2022-08-17 14:58:57 +00:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
2022-08-19 12:55:06 +00:00
|
|
|
pub position: DiagnosticArgFromDisplay<'a>,
|
2022-08-17 14:58:57 +00:00
|
|
|
}
|
2022-08-17 17:48:25 +00:00
|
|
|
|
2023-02-14 19:15:43 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ast_lowering_misplaced_assoc_ty_binding)]
|
|
|
|
pub struct MisplacedAssocTyBinding<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub position: DiagnosticArgFromDisplay<'a>,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_underscore_expr_lhs_assign)]
|
2022-08-17 17:48:25 +00:00
|
|
|
pub struct UnderscoreExprLhsAssign {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_base_expression_double_dot)]
|
2022-08-17 17:48:25 +00:00
|
|
|
pub struct BaseExpressionDoubleDot {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_await_only_in_async_fn_and_blocks, code = "E0728")]
|
2022-08-17 17:48:25 +00:00
|
|
|
pub struct AwaitOnlyInAsyncFnAndBlocks {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
2023-04-27 17:40:55 +00:00
|
|
|
pub await_kw_span: Span,
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_this_not_async)]
|
2022-08-17 17:48:25 +00:00
|
|
|
pub item_span: Option<Span>,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2023-10-19 21:46:28 +00:00
|
|
|
#[diag(ast_lowering_coroutine_too_many_parameters, code = "E0628")]
|
2023-10-19 16:06:43 +00:00
|
|
|
pub struct CoroutineTooManyParameters {
|
2022-08-17 17:48:25 +00:00
|
|
|
#[primary_span]
|
|
|
|
pub fn_decl_span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_closure_cannot_be_static, code = "E0697")]
|
2022-08-17 17:48:25 +00:00
|
|
|
pub struct ClosureCannotBeStatic {
|
|
|
|
#[primary_span]
|
|
|
|
pub fn_decl_span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-08-17 17:48:25 +00:00
|
|
|
#[help]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_async_non_move_closure_not_supported, code = "E0708")]
|
2022-08-17 17:48:25 +00:00
|
|
|
pub struct AsyncNonMoveClosureNotSupported {
|
|
|
|
#[primary_span]
|
|
|
|
pub fn_decl_span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_functional_record_update_destructuring_assignment)]
|
2023-04-10 20:02:52 +00:00
|
|
|
pub struct FunctionalRecordUpdateDestructuringAssignment {
|
2022-08-17 17:48:25 +00:00
|
|
|
#[primary_span]
|
|
|
|
#[suggestion(code = "", applicability = "machine-applicable")]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2023-10-19 21:46:28 +00:00
|
|
|
#[diag(ast_lowering_async_coroutines_not_supported, code = "E0727")]
|
2023-10-19 16:06:43 +00:00
|
|
|
pub struct AsyncCoroutinesNotSupported {
|
2022-08-17 17:48:25 +00:00
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-08-17 21:00:33 +00:00
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_inline_asm_unsupported_target, code = "E0472")]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct InlineAsmUnsupportedTarget {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_att_syntax_only_x86)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct AttSyntaxOnlyX86 {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_abi_specified_multiple_times)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct AbiSpecifiedMultipleTimes {
|
|
|
|
#[primary_span]
|
|
|
|
pub abi_span: Span,
|
|
|
|
pub prev_name: Symbol,
|
|
|
|
#[label]
|
|
|
|
pub prev_span: Span,
|
|
|
|
#[note]
|
|
|
|
pub equivalent: Option<()>,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_clobber_abi_not_supported)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct ClobberAbiNotSupported {
|
|
|
|
#[primary_span]
|
|
|
|
pub abi_span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-17 21:00:33 +00:00
|
|
|
#[note]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_invalid_abi_clobber_abi)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct InvalidAbiClobberAbi {
|
|
|
|
#[primary_span]
|
|
|
|
pub abi_span: Span,
|
|
|
|
pub supported_abis: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_invalid_register)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct InvalidRegister<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub op_span: Span,
|
2022-08-19 12:55:06 +00:00
|
|
|
pub reg: Symbol,
|
|
|
|
pub error: &'a str,
|
2022-08-17 21:00:33 +00:00
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_invalid_register_class)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct InvalidRegisterClass<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
pub op_span: Span,
|
2022-08-19 12:55:06 +00:00
|
|
|
pub reg_class: Symbol,
|
|
|
|
pub error: &'a str,
|
2022-08-17 21:00:33 +00:00
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_invalid_asm_template_modifier_reg_class)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct InvalidAsmTemplateModifierRegClass {
|
|
|
|
#[primary_span]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_template_modifier)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub placeholder_span: Span,
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_argument)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub op_span: Span,
|
|
|
|
#[subdiagnostic]
|
|
|
|
pub sub: InvalidAsmTemplateModifierRegClassSub,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:47:31 +00:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub enum InvalidAsmTemplateModifierRegClassSub {
|
2022-10-22 09:07:54 +00:00
|
|
|
#[note(ast_lowering_support_modifiers)]
|
2022-08-17 21:00:33 +00:00
|
|
|
SupportModifier { class_name: Symbol, modifiers: String },
|
2022-10-22 09:07:54 +00:00
|
|
|
#[note(ast_lowering_does_not_support_modifiers)]
|
2022-08-17 21:00:33 +00:00
|
|
|
DoesNotSupportModifier { class_name: Symbol },
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_invalid_asm_template_modifier_const)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct InvalidAsmTemplateModifierConst {
|
|
|
|
#[primary_span]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_template_modifier)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub placeholder_span: Span,
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_argument)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub op_span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_invalid_asm_template_modifier_sym)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct InvalidAsmTemplateModifierSym {
|
|
|
|
#[primary_span]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_template_modifier)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub placeholder_span: Span,
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_argument)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub op_span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_register_class_only_clobber)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct RegisterClassOnlyClobber {
|
|
|
|
#[primary_span]
|
|
|
|
pub op_span: Span,
|
|
|
|
pub reg_class_name: Symbol,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_register_conflict)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub struct RegisterConflict<'a> {
|
|
|
|
#[primary_span]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_register1)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub op_span1: Span,
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_register2)]
|
2022-08-17 21:00:33 +00:00
|
|
|
pub op_span2: Span,
|
|
|
|
pub reg1_name: &'a str,
|
|
|
|
pub reg2_name: &'a str,
|
|
|
|
#[help]
|
|
|
|
pub in_out: Option<Span>,
|
|
|
|
}
|
2022-08-18 16:08:39 +00:00
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-08-18 16:08:39 +00:00
|
|
|
#[help]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_sub_tuple_binding)]
|
2022-08-18 16:08:39 +00:00
|
|
|
pub struct SubTupleBinding<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
2022-10-22 13:48:55 +00:00
|
|
|
#[suggestion(
|
2022-10-22 09:07:54 +00:00
|
|
|
ast_lowering_sub_tuple_binding_suggestion,
|
2022-10-22 13:48:55 +00:00
|
|
|
style = "verbose",
|
2022-08-18 16:08:39 +00:00
|
|
|
code = "..",
|
|
|
|
applicability = "maybe-incorrect"
|
|
|
|
)]
|
|
|
|
pub span: Span,
|
|
|
|
pub ident: Ident,
|
|
|
|
pub ident_name: Symbol,
|
|
|
|
pub ctx: &'a str,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_extra_double_dot)]
|
2022-08-18 16:08:39 +00:00
|
|
|
pub struct ExtraDoubleDot<'a> {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
2022-10-22 09:07:54 +00:00
|
|
|
#[label(ast_lowering_previously_used_here)]
|
2022-08-18 16:08:39 +00:00
|
|
|
pub prev_span: Span,
|
|
|
|
pub ctx: &'a str,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-08-18 16:08:39 +00:00
|
|
|
#[note]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_misplaced_double_dot)]
|
2022-08-18 16:08:39 +00:00
|
|
|
pub struct MisplacedDoubleDot {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-08-18 17:30:56 +00:00
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_misplaced_relax_trait_bound)]
|
2022-08-18 17:30:56 +00:00
|
|
|
pub struct MisplacedRelaxTraitBound {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_not_supported_for_lifetime_binder_async_closure)]
|
2022-08-18 17:30:56 +00:00
|
|
|
pub struct NotSupportedForLifetimeBinderAsyncClosure {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2023-11-27 00:53:05 +00: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-27 02:47:49 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
#[diag(ast_lowering_never_pattern_with_guard)]
|
|
|
|
pub struct NeverPatternWithGuard {
|
|
|
|
#[primary_span]
|
|
|
|
#[suggestion(code = "", applicability = "maybe-incorrect")]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_arbitrary_expression_in_pattern)]
|
2022-08-18 17:30:56 +00:00
|
|
|
pub struct ArbitraryExpressionInPattern {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-08-26 16:03:41 +00:00
|
|
|
|
2022-09-18 15:46:56 +00:00
|
|
|
#[derive(Diagnostic, Clone, Copy)]
|
2022-10-22 09:07:54 +00:00
|
|
|
#[diag(ast_lowering_inclusive_range_with_no_end)]
|
2022-08-26 16:03:41 +00:00
|
|
|
pub struct InclusiveRangeWithNoEnd {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-09-02 15:57:31 +00:00
|
|
|
|
2023-03-11 04:10:09 +00:00
|
|
|
#[derive(Diagnostic)]
|
|
|
|
pub enum BadReturnTypeNotation {
|
|
|
|
#[diag(ast_lowering_bad_return_type_notation_inputs)]
|
|
|
|
Inputs {
|
|
|
|
#[primary_span]
|
2023-04-10 22:16:17 +00:00
|
|
|
#[suggestion(code = "()", applicability = "maybe-incorrect")]
|
2023-03-11 04:10:09 +00:00
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
#[diag(ast_lowering_bad_return_type_notation_output)]
|
|
|
|
Output {
|
|
|
|
#[primary_span]
|
|
|
|
#[suggestion(code = "", applicability = "maybe-incorrect")]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
}
|