On 1/31/2017 10:43 PM, Tobias Müller wrote:
Using an FFI function to compare D vs Rust doesn't tell you much. Foreign
functions are usually not used directly in Rust, they are used to build
safe wrappers that will give you *all* possible guarantees, including type
safety.
As a consequence it's not necessary to augment the C declaration with
additional information.

I'm not very familiar with Rust. Can you post what a Rust declaration for memcpy would look like with all the guarantees?


Marking the function as safe would be wrong in Rust, because dereferencing
raw pointers is unsafe. Raw pointers are not necessarily valid, even in
safe code. You need references for that guarantee. But again, raw pointers
are usually only used for FFI and to build safe abstractions.

memcpy() isn't marked safe in D, either.

Reply via email to