-
Notifications
You must be signed in to change notification settings - Fork 78
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
warn when using higher mode types in parameters (and return) with lower modes, #170 #323
base: main
Are you sure you want to change the base?
Conversation
1834c82
to
849ebd3
Compare
There's nothing inherently wrong with writing an exec function that takes an exec
This is morally equivalent to |
I agree that this isn't a soundness issue. In terms of treating this as an error (vs a lint), my main concern was erasure: making sure that we wouldn't allow exec-mode parameters with types that don't have a runtime representation, but I suppose doing codegen for them may not be a big deal, as they can never be called by verified code. When we allow unverified clients, though, it may be best if these functions aren't allowed (although an unverified client would also find it non-trivial -- although not impossible -- to call these functions). |
b8cc396
to
b5435ef
Compare
One thing that I forgot to point out is that the intent here is to disallow it only in parameters. Incorrect usage in e.g. variables would still be allowed. The new commit should cover the case I missed and that you pointed out (thanks!), but there may be more that I missed. Do you think we should turn this into a warning? If we think this is fairly complete at this point, I'd argue we may want to have it be an error as (a) I don't see a use case where something that fails this check was intentional and (b) to protect against misuse by unverified clients in the future. |
What happens if the user writes |
Right. I see the problem now (brain is still a bit on vacation, I suspect). Thanks! I'll have another more careful look at this later. |
Triaged in the Verus meeting; we want to lower to warning, and make the min_typ_mode function partial to be correct. |
d168895
to
f2eb748
Compare
32a305f
to
9a3d651
Compare
f2eb748
to
3656fd7
Compare
…er modes addresses #170
3656fd7
to
6ad5ef3
Compare
temporarily based on the branch for preserve the type decoration in the type for Tracked<&mut T> params #746, which is a dependency