cmse: rephrase error message when types don't fit

This commit is contained in:
Folkert de Vries
2025-10-08 13:42:49 +02:00
parent f4d8bd3b47
commit b47de64cdb
5 changed files with 25 additions and 30 deletions

View File

@@ -80,11 +80,8 @@ hir_analysis_cmse_entry_generic =
hir_analysis_cmse_inputs_stack_spill =
arguments for `{$abi}` function too large to pass via registers
.label = {$plural ->
[false] this argument doesn't
*[true] these arguments don't
} fit in the available registers
.note = functions with the `{$abi}` ABI must pass all their arguments via the 4 32-bit available argument registers
.label = does not fit in the available registers
.note = functions with the `{$abi}` ABI must pass all their arguments via the 4 32-bit argument registers
hir_analysis_cmse_output_stack_spill =
return value of `{$abi}` function too large to pass via registers

View File

@@ -1617,7 +1617,6 @@ pub(crate) struct CmseInputsStackSpill {
#[primary_span]
#[label]
pub spans: Vec<Span>,
pub plural: bool,
pub abi: ExternAbi,
}

View File

@@ -124,8 +124,7 @@ fn is_valid_cmse_inputs<'tcx>(
if !excess_argument_spans.is_empty() {
// fn f(x: u32, y: u32, z: u32, w: u16, q: u16) -> u32,
// ^^^^^^
let plural = excess_argument_spans.len() != 1;
dcx.emit_err(errors::CmseInputsStackSpill { spans: excess_argument_spans, plural, abi });
dcx.emit_err(errors::CmseInputsStackSpill { spans: excess_argument_spans, abi });
}
Ok(())

View File

@@ -2,43 +2,43 @@ error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass v
--> $DIR/params-via-stack.rs:16:64
|
LL | f1: extern "cmse-nonsecure-call" fn(u32, u32, u32, u32, x: u32, y: u32),
| ^^^ ^^^ these arguments don't fit in the available registers
| ^^^ ^^^ does not fit in the available registers
| |
| these arguments don't fit in the available registers
| does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
--> $DIR/params-via-stack.rs:17:61
|
LL | f2: extern "cmse-nonsecure-call" fn(u32, u32, u32, u16, u16),
| ^^^ this argument doesn't fit in the available registers
| ^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
--> $DIR/params-via-stack.rs:18:51
|
LL | f3: extern "cmse-nonsecure-call" fn(u32, u64, u32),
| ^^^ this argument doesn't fit in the available registers
| ^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
--> $DIR/params-via-stack.rs:19:56
|
LL | f4: extern "cmse-nonsecure-call" fn(AlignRelevant, u32),
| ^^^ this argument doesn't fit in the available registers
| ^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
--> $DIR/params-via-stack.rs:20:41
|
LL | f5: extern "cmse-nonsecure-call" fn([u32; 5]),
| ^^^^^^^^ this argument doesn't fit in the available registers
| ^^^^^^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
error: aborting due to 5 previous errors

View File

@@ -2,43 +2,43 @@ error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass
--> $DIR/params-via-stack.rs:15:76
|
LL | pub extern "cmse-nonsecure-entry" fn f1(_: u32, _: u32, _: u32, _: u32, _: u32, _: u32) {}
| ^^^ ^^^ these arguments don't fit in the available registers
| ^^^ ^^^ does not fit in the available registers
| |
| these arguments don't fit in the available registers
| does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
--> $DIR/params-via-stack.rs:17:76
|
LL | pub extern "cmse-nonsecure-entry" fn f2(_: u32, _: u32, _: u32, _: u16, _: u16) {}
| ^^^ this argument doesn't fit in the available registers
| ^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
--> $DIR/params-via-stack.rs:19:60
|
LL | pub extern "cmse-nonsecure-entry" fn f3(_: u32, _: u64, _: u32) {}
| ^^^ this argument doesn't fit in the available registers
| ^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
--> $DIR/params-via-stack.rs:21:62
|
LL | pub extern "cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {}
| ^^^ this argument doesn't fit in the available registers
| ^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
--> $DIR/params-via-stack.rs:25:44
|
LL | pub extern "cmse-nonsecure-entry" fn f5(_: [u32; 5]) {}
| ^^^^^^^^ this argument doesn't fit in the available registers
| ^^^^^^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
error: aborting due to 5 previous errors