Skip to content

Verifying with --verify-module makes cargo's cache think all modules are OK #2799

Description

@jaylorch

The following code, divided into a Cargo.toml and two .rs files, verifies with cargo verus verify. However, if you then comment out the assume_specification in the second file, and rerun cargo verus verify, the output indicates no error. Verus should realize that main.rs is dependent on that change, and try to re-verify it (and fail). But you have to do cargo clean to see the error.

Cargo.toml:

[package]
name = "test1"
version = "0.1.0"
edition = "2024"

[package.metadata.verus]
verify = true

[dependencies]
vstd = { version = "=0.0.0-2026-08-09-0044" }
num-bigint = { version = "0.5", default-features = false }

src/main.rs:

use vstd::prelude::*;
use num_bigint::BigInt;

mod b;

use crate::b::*;

verus! {

pub fn convert_integer(i: i16)
{
    let m = BigInt::from(i);
    assert(m@ == i);
}

}

fn main() {
    convert_integer(3i16);
    println!("Hello, world!");
}

src/b.rs:

use vstd::prelude::*;
use num_bigint::BigInt;

verus! {

#[verifier::external_type_specification]
#[verifier::external_body]
pub struct ExNumBigInt(num_bigint::BigInt);

pub trait BigIntAdditionalSpecFns {
    spec fn view(&self) -> int;
}

impl BigIntAdditionalSpecFns for BigInt {
    uninterp spec fn view(&self) -> int;
}

pub assume_specification[ <BigInt as core::convert::From<i16>>::from ](i: i16) -> (res: BigInt)
    ensures
        res@ == i,
;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions