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

TraitTypes support #125

Open
franziskuskiefer opened this issue Jan 3, 2025 · 4 comments
Open

TraitTypes support #125

franziskuskiefer opened this issue Jan 3, 2025 · 4 comments

Comments

@franziskuskiefer
Copy link
Collaborator

franziskuskiefer commented Jan 3, 2025

Using trait types doesn't work when the trait is used in a type bound or in any other way.

trait T {
    type C;
    fn new() -> Self::C;
}
struct S {}
impl T for S {
    type C = [u8; 4];

    fn new() -> Self::C {
        Self::C::default()
    }
}

fn fun<Type: T>() {}

fn caller() {
    fun::<S>();
}

fn associated_type() -> [u8; 4] {
     S::new()
}

generates

void eurydice_tests_caller(void)
{
  KRML_HOST_EPRINTF("KaRaMeL abort at %s:%d\n%s\n",
    __FILE__,
    __LINE__,
    "Eurydice error: Failure(\"TODO: TraitTypes Self::C\")\n");
  KRML_HOST_EXIT(255U);
}

void eurydice_tests_associated_type(uint8_t ret[4U])
{
  KRML_HOST_EPRINTF("KaRaMeL abort at %s:%d\n%s\n",
    __FILE__,
    __LINE__,
    "Eurydice error: Failure(\"TODO: TraitTypes eurydice_tests::{eurydice_tests::T for eurydice_tests::S}::C\")\n");
  KRML_HOST_EXIT(255U);
}
@Nadrieril
Copy link
Member

Will get fixed by AeneasVerif/charon#127.

@franziskuskiefer
Copy link
Collaborator Author

Great! Do you have an ETA for those changes?

@Nadrieril
Copy link
Member

This month if all goes well, the next if not.

@msprotz
Copy link
Contributor

msprotz commented Jan 8, 2025

@franziskuskiefer and I had a chat this morning, and considering that Franziskus has a workaround already (and contrary to what I said earlier), I am now dropping this and will let you fix it upstream -- it's only a matter of weeks, not worth the extra complexity

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