2 ms·
It produces functions which are pub unsafe extern "C" -- which among other effects currently results in effectively wrapping the code in an unsafe block yes. I
by tialaramex 5y ago
It produces functions which are pub unsafe extern "C" -- which among other effects currently results in effectively wrapping the code in an unsafe block yes.
It seems as though the very long term plan is to divide more thoroughly the unsafe function declaration (purpose: To flag to people calling it that they need to be careful) from the unsafe block (purpose: To flag to the compiler that you checked this is OK and so it's fine that the compiler can't tell if it's OK). Today I believe the linter will optionally complain that you didn't clarify, and perhaps in the Rust 2021 edition the compiler will default to rejecting this, then perhaps Rust 2024 will just outlaw it.
I expect c2rust will eventually either just shove everything inside unsafe {} blocks as well as inside unsafe functions, or it will mark code as Rust 2018 edition and let you change that when you've written as idiomatic Rust.