E1861: native call without a stack claim

View source

The stack bound of a meta stack_limit verb includes the code it calls (ADR-0103).

The stack bound of a meta stack_limit verb includes the code it calls (ADR-0103). The compiler cannot see inside an unsafe extern function, so that function must state how much stack it uses, with its own meta stack_limit(bytes: N). The claim covers everything the native function calls. The compiler trusts it and does not check it. The error points at the call and names the function.

Example

actus
unsafe extern "C" verb native() -> Int;

meta stack_limit(bytes: 256u32)
verb run_native() -> Int {
    return native();
}

verb main() {
}

Fix

Declare the stack claim on the unsafe extern function.

actus
meta stack_limit(bytes: 128u32)
unsafe extern "C" verb native() -> Int;

meta stack_limit(bytes: 256u32)
verb run_native() -> Int {
    return native();
}

verb main() {
}
toml
[package]
name = "example"
version = "0.1.0"
edition = "alpha"
entry = "main"

[build]
target = "x86_64-unknown-linux-gnu"
profile = "debug"
runtime = "std"

Run actus explain E1861 in your terminal to read this entry offline. Browse Strict & toolchain or all error codes.