Expand description
Function Pointer Safety Analysis
This module implements safety checking for function pointers using type-level
encoding with SafeFn<Sig> and UnsafeFn<Sig> wrapper types.
Key concepts:
SafeFn<Ret(Args...)>- holds a pointer to a @safe function, can be called safelyUnsafeFn<Ret(Args...)>- holds any function pointer, requires @unsafe to call- Raw function pointers require @unsafe to call
See docs/FUNCTION_POINTER_SAFETY_PLAN.md for the full design.
Structs§
- Safe
FnAssignment Check - Result of checking a SafeFn assignment
Functions§
- check_
function_ pointer_ safety - Check function pointer safety in a parsed function
- check_
raw_ function_ pointer_ call - Check if a function call expression is through a raw function pointer Returns Some(error) if the call requires @unsafe
- is_
member_ fn_ wrapper_ type - Check if a type is a member function pointer wrapper (safe or unsafe)
- is_
raw_ function_ pointer_ type - Check if a type is a raw function pointer Matches patterns like: void ()(int), int ()(const char*, …), void (MyClass::*)(int)
- is_
raw_ member_ function_ pointer_ type - Check if a type is a raw member function pointer Matches patterns like: void (MyClass::)(int), int (Widget::)(double) const
- is_
safe_ fn_ call - Check if a function call is calling through a SafeFn or SafeMemFn wrapper
- is_
safe_ fn_ type - Check if a type is a SafeFn wrapper type
- is_
unsafe_ fn_ call_ unsafe_ method - Check if a function call is calling through an UnsafeFn or UnsafeMemFn wrapper
- is_
unsafe_ fn_ type - Check if a type is an UnsafeFn wrapper type