Rollup merge of #72605 - GuillaumeGomez:cleanup-e0617, r=Dylan-DPC

Add working example for E0617 explanation

r? @Dylan-DPC
This commit is contained in:
Dylan DPC 2020-05-29 02:33:14 +02:00 committed by GitHub
commit 235f382731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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