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

About heap restriction in PPtr #1227

Open
zpzigi754 opened this issue Jul 16, 2024 · 5 comments
Open

About heap restriction in PPtr #1227

zpzigi754 opened this issue Jul 16, 2024 · 5 comments

Comments

@zpzigi754
Copy link
Contributor

In the document about PPtr, it is mentioned that the target object should be allocated through heap.

However, in the low-level programming, many objects could be allocated without using heap.

Is there any way to circumvent the heap-related restriction in PPtr?
If one wants to use PPtr-like structure for the raw pointer not pointing to the heap, what is the biggest challenge to overcome?

It would be great if verus team support this feature: PPtr for non-heap objects.

@tjhance
Copy link
Collaborator

tjhance commented Jul 16, 2024

The next generation of Verus pointer support is something that is being actively worked on. The first step is to create a more precise model of pointers, which you can see in vstd/raw_ptr.rs. (However, I would not recommend using it yet.) The new interface is going to operate on the actual Rust pointer types (*mut T and *const T) rather than PPtr. I expect we'll eventually have ways to manipulate pointers that point to stack variables, cell interiors, and so on.

@zpzigi754
Copy link
Contributor Author

zpzigi754 commented Jul 17, 2024

Thank you very much for the explanation and the reference, @tjhance. Good to hear the news about verus's next generation pointer support!

Is there any reason that you do not recommend using the APIs (e.g., ptr_mut_write, ptr_mut_read, and ptr_ref) in vstd/raw_ptr.rs yet? I see the relevant PR in #1052.

@tjhance
Copy link
Collaborator

tjhance commented Jul 17, 2024

The simple reason is that it's still a work-in-progress. It doesn't have enough features to be useful.

@zpzigi754
Copy link
Contributor Author

@tjhance, raw pointers have been updated in #1244. Do you now recommend using vstd/raw_ptr.rs?

@tjhance
Copy link
Collaborator

tjhance commented Aug 26, 2024

Yes. Unfortunately, they still don't support the feature requested by this issue. However, we are getting closer.

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

2 participants