-
Notifications
You must be signed in to change notification settings - Fork 71
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Chained conjunction forces spec mode #1149
Comments
Definitely a confusing error message that should be fixed. I'm not really sure about supporting chained inequalities in exec code though. I think generally it's a good idea to leave exec code as 'normal rust' as much as possible. |
While I acknowledge your point, I'd like to also remind us that |
Given that Rust hasn't had chained comparison in a while (relevant thread that started in 2017: rust-lang/rfcs#2083), and our semantics of chained comparison (e.g., ((Click here for current rustc error message))$ rustc x.rs
error: comparison operators cannot be chained
--> x.rs:2:8
|
2 | if 1 < 2 < 3 {
| ^ ^
|
help: split the comparison into two
|
2 | if 1 < 2 && 2 < 3 {
| ++++
error: aborting due to 1 previous error Important things to keep in mind (esp in exec-mode), if we decide to include this:
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Run this with verus:
You'll get
error: condition must have mode exec
, which is quite confusing.A workaround is to replace the condition with
a <= b && b <= c
, so evidently operator chaining causes the expression to suddenly become a spec expression.Is there any reason we shouldn't allow chained expressions in exec text and desugar them to a collection of conjuncts?
The text was updated successfully, but these errors were encountered: