Skip to content
New issue

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

Support ? operator #105

Open
franziskuskiefer opened this issue Dec 7, 2024 · 3 comments
Open

Support ? operator #105

franziskuskiefer opened this issue Dec 7, 2024 · 3 comments

Comments

@franziskuskiefer
Copy link
Collaborator

The question mark operator is not supported.

The following Rust code

fn inner() -> Result<(), u8> {
    Err(1)
}

fn call_it() -> Result<(), u8> {
    inner()?;
    Ok(())
}

generates the following C code.

core_result_Result_55 eurydice_tests_call_it(void)
{
  KRML_HOST_EPRINTF("KaRaMeL abort at %s:%d\n%s\n",
    __FILE__,
    __LINE__,
    "Eurydice error: Failure(\"TODO: TraitTypes core::result::{core::ops::try_trait::Try for core::result::Result<T, E>[TraitClause@0, TraitClause@1]}#26<T@0, T@1>[TraitClause@0, TraitClause@1]::Residual\")\n");
  KRML_HOST_EXIT(255U);
}
@msprotz
Copy link
Contributor

msprotz commented Dec 23, 2024

This boils down to support for associated types, which would require a little bit of feature work, to encode the associated types in trait parameters as type arguments to pre-monomorphized functions.

@Nadrieril
Copy link
Member

Nadrieril commented Dec 26, 2024

You'll get support for associated types for free once we solve AeneasVerif/charon#127, which is at the top of my priority queue.

@msprotz
Copy link
Contributor

msprotz commented Dec 26, 2024

Indeed, I was thinking of doing the same encoding at the eurydice level (types within traits as type parameters of the enclosing function), but if you're doing it in Charon, then indeed it should come "for free". Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants