- 
                Notifications
    
You must be signed in to change notification settings  - Fork 124
 
Description
Hi,
I'm brand new to this ecosystem, I just discovered Verus and Anvil a few days ago. It seems Verus is in the middle of pushing towards making things feel more out-of-the-box and cargo-native with the addition of cargo verus, which is great!
I opened an issue in the Anvil repo about supporting cargo verus and have been having a go at that, which involves moving some of the code into cargo binaries. However, I discovered a peculiar issue. I have a minimal repro, so let me explain -- here is my project layout:
test
├── Cargo.lock
├── Cargo.toml
├── src
│   ├── lib.rs
│   └── main.rs
└── test2
    ├── Cargo.lock
    ├── Cargo.toml
    └── src
        └── lib.rstest2 has test as a dependency. test/src/lib.rs defines a trait like this:
verus! {
pub trait Foo {
    open spec fn hello() -> int {
        42
    }
}
}And then in both src/main.rs and test2/src/lib.rs I have a trait impl like this:
verus! {
struct Bar {}
    
impl test::Foo for Bar {
    open spec fn hello() -> int {
        43
    }
}
}As it turns out, the one in test2/src/lib.rs compiles, but the one in src/main.rs fails with the following error:
❯ cargo verus build
   Compiling test v0.1.0 (/home/suremarc/anvil/test)
error: function for external trait must have mode 'exec'
 --> src/main.rs:8:15
  |
8 |     open spec fn hello() -> int {
  |               ^^^^^^^^^^^^^^^^^
error: could not compile `test` (bin "test") due to 1 previous errorBeing new to the ecosystem, I'm not 100% what's happening here, but from what I could gather reading issues and docs, traits are either marked as 'external' (not proof or spec-carrying) or verified. Since Foo comes from a verus! invocation it should be verified, and indeed, again the code in test2/src/lib.rs compiles fine even though Foo is external to test2. It seems like maybe this is a case overlooked by Verus?
I've attached the repro as a .zip file below. Thanks for reading this far!