Skip to content

Commit 235f382

Browse files
authored
Rollup merge of #72605 - GuillaumeGomez:cleanup-e0617, r=Dylan-DPC
Add working example for E0617 explanation r? @Dylan-DPC
2 parents 3bcf697 + 5548e69 commit 235f382

File tree

1 file changed

+11
-0
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+11
-0
lines changed

src/librustc_error_codes/error_codes/E0617.md

+11
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ Certain Rust types must be cast before passing them to a variadic function,
1717
because of arcane ABI rules dictated by the C standard. To fix the error,
1818
cast the value to the type specified by the error message (which you may need
1919
to import from `std::os::raw`).
20+
21+
In this case, `c_double` has the same size as `f64` so we can use it directly:
22+
23+
```no_run
24+
# extern {
25+
# fn printf(c: *const i8, ...);
26+
# }
27+
unsafe {
28+
printf(::std::ptr::null(), 0f64); // ok!
29+
}
30+
```

0 commit comments

Comments
 (0)