-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
Since rust 1.82, it was decided that extern blocks should be unsafe, and safe fn variants was also added to it.
// I assert all items in extern block are correct
unsafe extern {
// safe fn
pub safe fn foo();
// unsafe fn
pub unsafe fn bar();
// default unsafe fn
pub fn foobar();
}In light of these changes, I think it makes sense to allow #[host_fn] to more closely match the new way of doing things. The current way #[host_fn] does things matches the old Rust behavior before the change.
On < 1.82 <= 2021 the old way is done. On >= 1.82 <= 2021 the new way is supported but not enforced (but is strongly encouraged). On 1.85* >= 2024, the new way is required
* the version when 2024 was released
In the context of #[host_fn]:
unsafe externsignifies the writers assertion that all items in the extern block are correct- in combination with the above, we can now allow
safe fnsince we have made a safety assertion
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels