Skip to content

Commit aebec28

Browse files
committed
Update wording of diagnostic
1 parent 65598c8 commit aebec28

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

compiler/rustc_hir_typeck/messages.ftl

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ hir_typeck_option_result_asref = use `{$def_path}::as_ref` to convert `{$expecte
139139
hir_typeck_option_result_cloned = use `{$def_path}::cloned` to clone the value inside the `{$def_path}`
140140
hir_typeck_option_result_copied = use `{$def_path}::copied` to copy the value inside the `{$def_path}`
141141
142-
hir_typeck_pass_to_variadic_function = can't pass `{$ty}` to variadic function
142+
hir_typeck_pass_to_variadic_function = can't pass `{$ty}` into variable arguments
143143
.suggestion = cast the value to `{$cast_ty}`
144144
.help = cast the value to `{$cast_ty}`
145-
.teach_help = certain types, like `{$ty}`, must be casted before passing them to a variadic function, because of arcane ABI rules dictated by the C standard
145+
.teach_help = a `{$ty}` would be cast to `{$cast_ty}` by C's default argument promotion
146146
147147
hir_typeck_remove_semi_for_coerce = you might have meant to return the `match` expression
148148
hir_typeck_remove_semi_for_coerce_expr = this could be implicitly returned but it is a statement, not a tail expression

tests/ui/c-variadic/issue-32201.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn bar(_: *const u8) {}
77
fn main() {
88
unsafe {
99
foo(0, bar);
10-
//~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function
10+
//~^ ERROR can't pass `fn(*const u8) {bar}` into variable arguments
1111
//~| HELP cast the value to `fn(*const u8)`
1212
}
1313
}

tests/ui/c-variadic/issue-32201.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0617]: can't pass `fn(*const u8) {bar}` to variadic function
1+
error[E0617]: can't pass `fn(*const u8) {bar}` into variable arguments
22
--> $DIR/issue-32201.rs:9:16
33
|
44
LL | foo(0, bar);

tests/ui/c-variadic/variadic-ffi-1.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,37 +58,37 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
5858
= note: expected fn pointer `extern "C" fn(_, _, ...)`
5959
found fn item `extern "C" fn(_, _) {bar}`
6060

61-
error[E0617]: can't pass `f32` to variadic function
61+
error[E0617]: can't pass `f32` into variable arguments
6262
--> $DIR/variadic-ffi-1.rs:28:19
6363
|
6464
LL | foo(1, 2, 3f32);
6565
| ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
6666

67-
error[E0617]: can't pass `bool` to variadic function
67+
error[E0617]: can't pass `bool` into variable arguments
6868
--> $DIR/variadic-ffi-1.rs:29:19
6969
|
7070
LL | foo(1, 2, true);
7171
| ^^^^ help: cast the value to `c_int`: `true as c_int`
7272

73-
error[E0617]: can't pass `i8` to variadic function
73+
error[E0617]: can't pass `i8` into variable arguments
7474
--> $DIR/variadic-ffi-1.rs:30:19
7575
|
7676
LL | foo(1, 2, 1i8);
7777
| ^^^ help: cast the value to `c_int`: `1i8 as c_int`
7878

79-
error[E0617]: can't pass `u8` to variadic function
79+
error[E0617]: can't pass `u8` into variable arguments
8080
--> $DIR/variadic-ffi-1.rs:31:19
8181
|
8282
LL | foo(1, 2, 1u8);
8383
| ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
8484

85-
error[E0617]: can't pass `i16` to variadic function
85+
error[E0617]: can't pass `i16` into variable arguments
8686
--> $DIR/variadic-ffi-1.rs:32:19
8787
|
8888
LL | foo(1, 2, 1i16);
8989
| ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
9090

91-
error[E0617]: can't pass `u16` to variadic function
91+
error[E0617]: can't pass `u16` into variable arguments
9292
--> $DIR/variadic-ffi-1.rs:33:19
9393
|
9494
LL | foo(1, 2, 1u16);

tests/ui/error-codes/E0617.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ extern "C" {
55
fn main() {
66
unsafe {
77
printf(::std::ptr::null(), 0f32);
8-
//~^ ERROR can't pass `f32` to variadic function
8+
//~^ ERROR can't pass `f32` into variable arguments
99
//~| HELP cast the value to `c_double`
1010
printf(::std::ptr::null(), 0i8);
11-
//~^ ERROR can't pass `i8` to variadic function
11+
//~^ ERROR can't pass `i8` into variable arguments
1212
//~| HELP cast the value to `c_int`
1313
printf(::std::ptr::null(), 0i16);
14-
//~^ ERROR can't pass `i16` to variadic function
14+
//~^ ERROR can't pass `i16` into variable arguments
1515
//~| HELP cast the value to `c_int`
1616
printf(::std::ptr::null(), 0u8);
17-
//~^ ERROR can't pass `u8` to variadic function
17+
//~^ ERROR can't pass `u8` into variable arguments
1818
//~| HELP cast the value to `c_uint`
1919
printf(::std::ptr::null(), 0u16);
20-
//~^ ERROR can't pass `u16` to variadic function
20+
//~^ ERROR can't pass `u16` into variable arguments
2121
//~| HELP cast the value to `c_uint`
2222
printf(::std::ptr::null(), printf);
23-
//~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
23+
//~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` into variable arguments
2424
//~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)`
2525
}
2626
}

tests/ui/error-codes/E0617.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
error[E0617]: can't pass `f32` to variadic function
1+
error[E0617]: can't pass `f32` into variable arguments
22
--> $DIR/E0617.rs:7:36
33
|
44
LL | printf(::std::ptr::null(), 0f32);
55
| ^^^^ help: cast the value to `c_double`: `0f32 as c_double`
66

7-
error[E0617]: can't pass `i8` to variadic function
7+
error[E0617]: can't pass `i8` into variable arguments
88
--> $DIR/E0617.rs:10:36
99
|
1010
LL | printf(::std::ptr::null(), 0i8);
1111
| ^^^ help: cast the value to `c_int`: `0i8 as c_int`
1212

13-
error[E0617]: can't pass `i16` to variadic function
13+
error[E0617]: can't pass `i16` into variable arguments
1414
--> $DIR/E0617.rs:13:36
1515
|
1616
LL | printf(::std::ptr::null(), 0i16);
1717
| ^^^^ help: cast the value to `c_int`: `0i16 as c_int`
1818

19-
error[E0617]: can't pass `u8` to variadic function
19+
error[E0617]: can't pass `u8` into variable arguments
2020
--> $DIR/E0617.rs:16:36
2121
|
2222
LL | printf(::std::ptr::null(), 0u8);
2323
| ^^^ help: cast the value to `c_uint`: `0u8 as c_uint`
2424

25-
error[E0617]: can't pass `u16` to variadic function
25+
error[E0617]: can't pass `u16` into variable arguments
2626
--> $DIR/E0617.rs:19:36
2727
|
2828
LL | printf(::std::ptr::null(), 0u16);
2929
| ^^^^ help: cast the value to `c_uint`: `0u16 as c_uint`
3030

31-
error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
31+
error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` into variable arguments
3232
--> $DIR/E0617.rs:22:36
3333
|
3434
LL | printf(::std::ptr::null(), printf);

0 commit comments

Comments
 (0)