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

Annotate SMIR with lifetime information #78

Open
xldenis opened this issue May 10, 2024 · 2 comments
Open

Annotate SMIR with lifetime information #78

xldenis opened this issue May 10, 2024 · 2 comments

Comments

@xldenis
Copy link

xldenis commented May 10, 2024

The rust compiler intentionally hides all lifetime information to avoid introducing accidental dependencies on it during compilation and to improve the effectiveness of caching throughout the compiler. Tools like Prusti, Verus or Gillian-Rust on the other hand depend on having access to precise information about the borrows and lifetimes available in a given function.

Currently, a compromise solution has been reached with the compiler giving partial visibility into some of the information calculated by borrowck, allowing tool authors to mostly achieve their goals, though often with significant work on their end.

If SMIR included lifetime information, this would be a killer feature, providing something of huge value to external users while also allowing rustc keep its borrowck implementation private.

Specifically, I would like borrows to be annotated with their regions, and for those regions to have been unified throughout the MIR body. It should also be easy to regions are universal, and to answer outlives questions between regions.

@celinval
Copy link
Contributor

@oli-obk any thoughts?

@xldenis Can you please point to an example on how this is used today?

@xldenis
Copy link
Author

xldenis commented May 13, 2024

@xldenis Can you please point to an example on how this is used today?

Some are still currently private source, unfortunately. What I can say is that we need to know what the lifetimes of each borrow are and how they relate to the lifetime parameters of the fucntion. We also need to know how the lifetime parameters of called functions are instantiated.

@dewert99 used also lifetime information when compiling his specifications to Creusot's specification language.

Additionally, internally in Prusti lifetime information is also used during compilation to determine when to insert magic wands in the compiled Viper code.

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