Skip to content

Feature request: option to mark function as safe #3443

Description

@DanielEScherzer

External functions are assumed to be unsafe (https://doc.rust-lang.org/reference/items/external-blocks.html#r-items.extern.fn.safety) but there should be an option to mark one as safe

For example, for FFI bindings for the PHP source, the function zend_html_putc (https://github.com/php/php-src/blob/d03163dc0af54f9c0687ab345f5db2584563b2a7/Zend/zend_highlight.c#L28) is always going to be safe - it just prints a character. Similarly, zend_gdb_present (https://github.com/php/php-src/blob/PHP-8.5.10/Zend/zend_gdb.c#L110) takes no parameters and returns a boolean reporting if GDB is present - this function is always going to be safe to call

There should be a way to indicate that a specific function should be marked as safe

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions