LYR-SEM0234
an unsafe block that holds no memory operation
An unsafe { … } block calls none of std.ffi's memory operations, or stands within another unsafe block, which covers what it holds already.
Explanation
An unsafe block marks where the program holds to what the compiler cannot see — the reader looks there and nowhere else. A block that holds no memory operation (a pointer's read, write, offset or cast, alloc, free, GcHandle.from) marks nothing, and one within another says again what the outer one says. Calling a C function is not unsafe.
Drop the word, or move the block to the memory operations it was meant for, as small as it can be.
Wrong
extern "C" fn abs(n: int32): int32;
fn main(): void {
unsafe {
let _ = abs(-3);
}
}
Right
extern "C" fn abs(n: int32): int32;
fn main(): void {
let _ = abs(-3);
}