S0142: unsafe operation outside unsafe block
Generated from rellum-diagnostics/src/db.rs.
Explanation
Some operations, including calling extern C functions, reading and writing through raw pointers, and raw memory allocation, can violate memory safety if used incorrectly. Rellum requires these operations to appear inside an unsafe { } block so the programmer explicitly acknowledges the risk.
Common causes
- calling an extern C function outside an unsafe block
- using Ptr[T] methods outside an unsafe block
Canonical fixes
- wrap the unsafe operation in unsafe { ... }
Before:
value = strlen(ptr)
After:
value = unsafe { strlen(ptr) }
Code example
value = strlen(ptr)