We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 969a6c2 commit 7ecc66cCopy full SHA for 7ecc66c
compiler/rustc_error_codes/src/error_codes/E0617.md
@@ -4,11 +4,11 @@ Erroneous code example:
4
5
```compile_fail,E0617
6
extern "C" {
7
- fn printf(c: *const i8, ...);
+ fn printf(c: *const u8, ...) -> std::os::raw::c_int;
8
}
9
10
unsafe {
11
- printf(::std::ptr::null(), 0f32);
+ printf("my favourite number is %f".as_ptr(), 4_f32);
12
// error: cannot pass an `f32` to variadic function, cast to `c_double`
13
14
```
@@ -22,9 +22,9 @@ In this case, `c_double` has the same size as `f64` so we can use it directly:
22
23
```no_run
24
# extern "C" {
25
-# fn printf(c: *const i8, ...);
+# fn printf(c: *const u8, ...) -> std::os::raw::c_int;
26
# }
27
28
- printf(::std::ptr::null(), 0f64); // ok!
+ printf("my favourite number is %f".as_ptr(), 4_f64); // ok!
29
30
0 commit comments