-
Notifications
You must be signed in to change notification settings - Fork 50
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
ghost!{e} requires e to be Sized #1219
Comments
|
Why would we want to manipulate unsized objects in ghost code? In the example you are mentioning, you use a slice, a Rust executable concept, while a sequence, a Creusot ghost concept could do the job. Perhaps the problem is that we don't have sequence litterals, which we should add somehow. (As we discussed recently, the name |
This is true, but
true... @Armael then if you really want to manipulate unsized data, you can wrap it in a #[trusted]
fn into_raw_ptr<T>(p: Box<T>) -> (*mut T, GhostBox<PtrOwn<T>>) {
(Box::into_raw(p), ghost!(panic!()))
} In this case, if |
OK, that's a good trick indeed.
But why should we restrict Ghost code to only contain Sized objects? Ghost values don't exist at runtime anyway, so I don't see why sizedness should matter. As @arnaudgolfouse mentions, the question came up when designing an API that provides a ghost token For To be clear, I'm not against requiring |
A limitation of the current implementation of
ghost!{e}
is that it requirese
to be Sized.After talking with @arnaudgolfouse this is because it desugars into
|| GhostBox::new(e)
, which entails thate
must be Sized since it is passed as an argument to a function.In principle, it would be nice to also support patterns of the form:
which are possible with the normal
Box
.The text was updated successfully, but these errors were encountered: