Skip to content

Commit b47de64

Browse files
committed
cmse: rephrase error message when types don't fit
1 parent f4d8bd3 commit b47de64

File tree

5 files changed

+25
-30
lines changed

5 files changed

+25
-30
lines changed

compiler/rustc_hir_analysis/messages.ftl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,8 @@ hir_analysis_cmse_entry_generic =
8080
8181
hir_analysis_cmse_inputs_stack_spill =
8282
arguments for `{$abi}` function too large to pass via registers
83-
.label = {$plural ->
84-
[false] this argument doesn't
85-
*[true] these arguments don't
86-
} fit in the available registers
87-
.note = functions with the `{$abi}` ABI must pass all their arguments via the 4 32-bit available argument registers
83+
.label = does not fit in the available registers
84+
.note = functions with the `{$abi}` ABI must pass all their arguments via the 4 32-bit argument registers
8885
8986
hir_analysis_cmse_output_stack_spill =
9087
return value of `{$abi}` function too large to pass via registers

compiler/rustc_hir_analysis/src/errors.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,6 @@ pub(crate) struct CmseInputsStackSpill {
16171617
#[primary_span]
16181618
#[label]
16191619
pub spans: Vec<Span>,
1620-
pub plural: bool,
16211620
pub abi: ExternAbi,
16221621
}
16231622

compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ fn is_valid_cmse_inputs<'tcx>(
124124
if !excess_argument_spans.is_empty() {
125125
// fn f(x: u32, y: u32, z: u32, w: u16, q: u16) -> u32,
126126
// ^^^^^^
127-
let plural = excess_argument_spans.len() != 1;
128-
dcx.emit_err(errors::CmseInputsStackSpill { spans: excess_argument_spans, plural, abi });
127+
dcx.emit_err(errors::CmseInputsStackSpill { spans: excess_argument_spans, abi });
129128
}
130129

131130
Ok(())

tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,43 @@ error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass v
22
--> $DIR/params-via-stack.rs:16:64
33
|
44
LL | f1: extern "cmse-nonsecure-call" fn(u32, u32, u32, u32, x: u32, y: u32),
5-
| ^^^ ^^^ these arguments don't fit in the available registers
5+
| ^^^ ^^^ does not fit in the available registers
66
| |
7-
| these arguments don't fit in the available registers
7+
| does not fit in the available registers
88
|
9-
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
9+
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
1010

1111
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
1212
--> $DIR/params-via-stack.rs:17:61
1313
|
1414
LL | f2: extern "cmse-nonsecure-call" fn(u32, u32, u32, u16, u16),
15-
| ^^^ this argument doesn't fit in the available registers
15+
| ^^^ does not fit in the available registers
1616
|
17-
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
17+
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
1818

1919
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
2020
--> $DIR/params-via-stack.rs:18:51
2121
|
2222
LL | f3: extern "cmse-nonsecure-call" fn(u32, u64, u32),
23-
| ^^^ this argument doesn't fit in the available registers
23+
| ^^^ does not fit in the available registers
2424
|
25-
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
25+
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
2626

2727
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
2828
--> $DIR/params-via-stack.rs:19:56
2929
|
3030
LL | f4: extern "cmse-nonsecure-call" fn(AlignRelevant, u32),
31-
| ^^^ this argument doesn't fit in the available registers
31+
| ^^^ does not fit in the available registers
3232
|
33-
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
33+
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
3434

3535
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
3636
--> $DIR/params-via-stack.rs:20:41
3737
|
3838
LL | f5: extern "cmse-nonsecure-call" fn([u32; 5]),
39-
| ^^^^^^^^ this argument doesn't fit in the available registers
39+
| ^^^^^^^^ does not fit in the available registers
4040
|
41-
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers
41+
= note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
4242

4343
error: aborting due to 5 previous errors
4444

tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,43 @@ error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass
22
--> $DIR/params-via-stack.rs:15:76
33
|
44
LL | pub extern "cmse-nonsecure-entry" fn f1(_: u32, _: u32, _: u32, _: u32, _: u32, _: u32) {}
5-
| ^^^ ^^^ these arguments don't fit in the available registers
5+
| ^^^ ^^^ does not fit in the available registers
66
| |
7-
| these arguments don't fit in the available registers
7+
| does not fit in the available registers
88
|
9-
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
9+
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
1010

1111
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
1212
--> $DIR/params-via-stack.rs:17:76
1313
|
1414
LL | pub extern "cmse-nonsecure-entry" fn f2(_: u32, _: u32, _: u32, _: u16, _: u16) {}
15-
| ^^^ this argument doesn't fit in the available registers
15+
| ^^^ does not fit in the available registers
1616
|
17-
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
17+
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
1818

1919
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
2020
--> $DIR/params-via-stack.rs:19:60
2121
|
2222
LL | pub extern "cmse-nonsecure-entry" fn f3(_: u32, _: u64, _: u32) {}
23-
| ^^^ this argument doesn't fit in the available registers
23+
| ^^^ does not fit in the available registers
2424
|
25-
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
25+
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
2626

2727
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
2828
--> $DIR/params-via-stack.rs:21:62
2929
|
3030
LL | pub extern "cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {}
31-
| ^^^ this argument doesn't fit in the available registers
31+
| ^^^ does not fit in the available registers
3232
|
33-
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
33+
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
3434

3535
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
3636
--> $DIR/params-via-stack.rs:25:44
3737
|
3838
LL | pub extern "cmse-nonsecure-entry" fn f5(_: [u32; 5]) {}
39-
| ^^^^^^^^ this argument doesn't fit in the available registers
39+
| ^^^^^^^^ does not fit in the available registers
4040
|
41-
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers
41+
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
4242

4343
error: aborting due to 5 previous errors
4444

0 commit comments

Comments
 (0)