Tweak incorrect ABI suggestion
Provide a better suggestion message, and make the suggestion verbose.
```
error[E0703]: invalid ABI: found `riscv-interrupt`
--> $DIR/riscv-discoverability-guidance.rs:17:8
|
LL | extern "riscv-interrupt" fn isr() {}
| ^^^^^^^^^^^^^^^^^ invalid ABI
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
help: there's a similarly named valid ABI `"riscv-interrupt-m"`
|
LL | extern "riscv-interrupt-m" fn isr() {}
| ++
```
This commit is contained in:
@@ -46,8 +46,9 @@ pub(crate) struct TupleStructWithDefault {
|
||||
#[derive(Subdiagnostic)]
|
||||
#[suggestion(
|
||||
ast_lowering_invalid_abi_suggestion,
|
||||
code = "{suggestion}",
|
||||
applicability = "maybe-incorrect"
|
||||
code = "\"{suggestion}\"",
|
||||
applicability = "maybe-incorrect",
|
||||
style = "verbose"
|
||||
)]
|
||||
pub(crate) struct InvalidAbiSuggestion {
|
||||
#[primary_span]
|
||||
|
||||
@@ -1510,7 +1510,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
span: abi.span,
|
||||
suggestion: suggested_name.map(|suggested_name| InvalidAbiSuggestion {
|
||||
span: abi.span,
|
||||
suggestion: format!("\"{suggested_name}\""),
|
||||
suggestion: suggested_name.to_string(),
|
||||
}),
|
||||
command: "rustc --print=calling-conventions".to_string(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user