Skip to main content

E0040: Runtime Requires Runtime

You used the runtime keyword with a function call that is not a runtime function.

Example

fn regular_function() -> i64 {
42
}

fn main() {
let x = runtime regular_function(); // Error: `runtime` can only be used with runtime function calls
}

How to fix

Only use runtime with runtime functions, or remove the runtime keyword:

fn regular_function() -> i64 {
42
}

fn main() {
let x = regular_function(); // OK - no runtime keyword needed
}