XO0205: `?` where the enclosing function cannot return the failure
? on a Result needs a function or closure that can fail, and ? on an optional needs one that returns an optional. A function without ! cannot propagate an error, and a requires ... else clause in such a function has nowhere to return its error either. Declare the error type (the diagnostic offers ! E as a fix), or handle the failure with match, ??, or ignore_err. See core 2.5 and 2.6.
Example
enum E { A }
fn g() -> Int ! E { 1 }
fn f() -> Int { g()? }Fix
enum E { A }
fn g() -> Int ! E { 1 }
fn f() -> Int ! E { g()? }Run xo explain XO0205 for this text in a terminal, or see
section 10.6 of the specification.