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

Panic with opaque associated function #1228

Open
hayley-leblanc opened this issue Jul 16, 2024 · 0 comments
Open

Panic with opaque associated function #1228

hayley-leblanc opened this issue Jul 16, 2024 · 0 comments

Comments

@hayley-leblanc
Copy link
Collaborator

I have an associated spec function I'd like to make opaque but I'm having trouble doing so. I initially tried something like this:

trait Foo {
    #[verifier::opaque]
    spec fn do_something() -> nat;
}

because I want all implementations to be opaque, but this results in the following error: error: opaque has no effect on a function without a body, so I assume this is not meant to be supported.

However, making an implementation opaque and then revealing it, e.g.,

impl Foo for u64 {
    #[verifier::opaque]
    spec fn do_something() -> nat { 0 }
}

fn test() {
    reveal(u64::do_something);
}

results in a panic:

thread 'rustc' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_hir/src/def.rs:645:45:
attempted .def_id() on invalid res: PrimTy(Uint(U64))

Some minimal code that reproduces this is at this playground link: https://play.verus-lang.org/?version=stable&mode=basic&edition=2021&gist=ef04f2b2e7422abceec947cc93bea554 which uses version 2024.07.15 6e30b8a

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

1 participant