We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pub struct S { pub g: Foo, } pub struct OtherS { pub g: Option<Foo>, } pub struct Foo { y: u8, } impl Foo { pub fn from(i: &Foo) -> Self { Self { y: i.y.clone(), } } } struct Error(); impl S { pub fn from(i: &OtherS) -> Result<Self, Error> { Ok(Self { g: Foo::from(i.g.as_ref().ok_or(Error())?), }) } }
Open this code snippet in the playground
The F* extraction from the example above contains:
let impl_S__from (i: t_OtherS) : Core.Result.t_Result t_S t_Error = match Core.Ops.Try_trait.f_branch #(Core.Result.t_Result t_Foo t_Error) #FStar.Tactics.Typeclasses.solve (Core.Option.impl__ok_or #t_Foo #t_Error (Core.Option.impl__as_ref #t_Foo i.f_g <: Core.Option.t_Option t_Foo) (Error <: t_Error) <: Core.Result.t_Result t_Foo t_Error ) <: Core.Ops.Control_flow.t_ControlFlow (Core.Result.t_Result Core.Convert.t_Infallible t_Error) t_Foo with | Core.Ops.Control_flow.ControlFlow_Break residual -> Core.Ops.Try_trait.f_from_residual #(Core.Result.t_Result t_S t_Error) #(Core.Result.t_Result Core.Convert.t_Infallible t_Error) #FStar.Tactics.Typeclasses.solve residual | Core.Ops.Control_flow.ControlFlow_Continue v_val -> Core.Result.Result_Ok ({ f_g = impl_Foo__from v_val } <: t_S ) <: Core.Result.t_Result t_S t_Error
This contains the raw encoding used by Rust for question marks, this should be reconstructed by the engine but it is not.
The text was updated successfully, but these errors were encountered:
A workaround is to write:
pub fn from(i: &OtherS) -> Result<Self, Error> { let g = i.g.as_ref().ok_or(Error())?; Ok(Self { g: Foo::from(g), }) }
Sorry, something went wrong.
maximebuyse
Successfully merging a pull request may close this issue.
Open this code snippet in the playground
The F* extraction from the example above contains:
This contains the raw encoding used by Rust for question marks, this should be reconstructed by the engine but it is not.
The text was updated successfully, but these errors were encountered: