S0056: cannot infer ok type of err
Generated from rellum-diagnostics/src/db.rs.
Explanation
The err(...) constructor supplies the error payload of a Result, but it does not name the success type. The surrounding annotation or expected type must establish Result[T, E] so the compiler can choose T.
Common causes
- returning err(...) from an unannotated function
- using err(...) in a graph or state binding without a Result annotation
- constructing err(...) where no surrounding Result type is expected
Canonical fixes
- add a Result annotation that names the ok type
Before:
value = err("failed")
After:
value: Result[Int, String] = err("failed")
- return err(...) from a function with an explicit Result return type
Before:
parse() = err("failed")
After:
parse() : Result[Int, String] = err("failed")
Code example
value = err("failed")