hax icon indicating copy to clipboard operation
hax copied to clipboard

Traits cannot be imported by their original module when they are part of a bundle

Open maximebuyse opened this issue 10 months ago • 3 comments

mod a {
    pub fn g(){super::b::h()}
    
    pub trait A {}

}
mod b {
    pub fn h(){super::a::g()}
}

struct B(u8);

impl a::A for B {}

Open this code snippet in the playground

Currently this doesn't lax-check because a::A is not exported outside module a.

If we have include Playground.Bundle {t_A as t_A} in Playground.A.fst, F* complains with something like: Definition Playground.Bundle.__proj__Mkt_A__item__v_Self cannot be found`.

For now the solution to avoid this error is to remove this include but this doesn't work if the trait is used outside the bundle. This probably needs a fix in F*

maximebuyse avatar Feb 03 '25 16:02 maximebuyse

This problem is not limited to traits, the same happens with parametric structs (like struct Foo<const N: usize> {...}

maximebuyse avatar Feb 04 '25 13:02 maximebuyse

@maximebuyse please improve the example to actually use the trait.

franziskuskiefer avatar Apr 03 '25 11:04 franziskuskiefer

@maximebuyse please improve the example to actually use the trait.

Done

maximebuyse avatar Apr 03 '25 11:04 maximebuyse

This issue has been marked as stale due to a lack of activity for 60 days. If you believe this issue is still relevant, please provide an update or comment to keep it open. Otherwise, it will be closed in 7 days.

github-actions[bot] avatar Jun 26 '25 00:06 github-actions[bot]

This issue has been closed due to a lack of activity since being marked as stale. If you believe this issue is still relevant, please reopen it with an update or comment.

github-actions[bot] avatar Jul 03 '25 00:07 github-actions[bot]

Still a problem

W95Psp avatar Jul 03 '25 06:07 W95Psp

This seems to be fixed in f*, I think we can have the include again for traits 🥳

maximebuyse avatar Jul 31 '25 09:07 maximebuyse