Change description of error (thanks @Manisheart)
This commit is contained in:
parent
11f0f47220
commit
ccb459e49a
1 changed files with 8 additions and 3 deletions
|
@ -381,8 +381,9 @@ fn main() {
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
E0045: r##"
|
E0045: r##"
|
||||||
Variadic parameters are only allowed in extern "C" code. Examples of
|
Rust only supports variadic parameters for interoperability with C code in its
|
||||||
erroneous code:
|
FFI. As such, variadic parameters can only be used with functions which are
|
||||||
|
using the C ABI. Examples of erroneous code:
|
||||||
|
|
||||||
```
|
```
|
||||||
extern "rust-call" { fn foo(x: u8, ...); }
|
extern "rust-call" { fn foo(x: u8, ...); }
|
||||||
|
@ -390,10 +391,14 @@ extern "rust-call" { fn foo(x: u8, ...); }
|
||||||
fn foo(x: u8, ...) {}
|
fn foo(x: u8, ...) {}
|
||||||
```
|
```
|
||||||
|
|
||||||
To fix such code, put them in extern "C" block:
|
To fix such code, put them in an extern "C" block:
|
||||||
|
|
||||||
```
|
```
|
||||||
extern "C" fn foo (x: u8, ...);
|
extern "C" fn foo (x: u8, ...);
|
||||||
|
// or:
|
||||||
|
extern "C" {
|
||||||
|
fn foo (x: u8, ...);
|
||||||
|
}
|
||||||
```
|
```
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue