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

Post-condition on function in impl fails if function uses &mut Self #1266

Open
karthikbhargavan opened this issue Jan 21, 2025 · 0 comments
Open

Comments

@karthikbhargavan
Copy link
Contributor

karthikbhargavan commented Jan 21, 2025

#[hax_lib::attributes]
trait T {
    #[hax_lib::ensures(|_|true)]
    fn v(x:&mut Self);
}

Open this code snippet in the playground

error[E0411]: cannot find type `Self` in this scope
 --> src/lib.rs:4:17
  |
1 | #[hax_lib::attributes]
  | ---------------------- `Self` not allowed in a function
...
4 |     fn v(x:&mut Self);
  |                 ^^^^ `Self` is only available in impls, traits, and type definitions

Works if the ensures is removed.

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