#E0061: operation needs unsafe
The operation can break memory safety: calling an unsafe or extern function, reading a union field, or indexing a GcBuf without a check. Wrap it in unsafe { .. }, inside an unsafe fn if it is a building block.
nabi
unsafe fn danger() -> i32 { 1 }
println(f"{danger()}");
error[E0061]: call to unsafe function `danger` outside an `unsafe` block or `unsafe fn` --> main.nabi:2:12 | 2 | println(f"{danger()}"); | ^^^^^^^^ | = help: wrap the call in `unsafe { .. }`; every `extern` function, `extern "nabi"` included, is unsafe to call
Wrap the call in unsafe { .. }:
nabi
unsafe fn danger() -> i32 { 1 }
println(f"{unsafe { danger() }}");
1
Related: E0084 invalid foreign-function use
Found a mistake? Edit this page on GitHub. Last updated