-
Notifications
You must be signed in to change notification settings - Fork 58
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
Stacked Borrows: Handling of two-phase borrows #85
Comments
rust-lang/miri#1878 contains an interesting example of code that we really ought to reject, but currently accept due to two-phase borrows. |
I had a proposal for how to handle two-phase borrows: https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/can.20.26mut.20just.20always.20be.20two-phase Collecting some relevant details here for reference purposes:
Mario Carneiro notes that
There's also an unanswered question of what reborrowing In that thread Ralf said
|
FWIW I still think it would be useful to know that the |
I agree that this seems very reasonable, potentially as part of the protectors also introduced by the function boundary. |
Closing as resolved by tree borrows. |
Basically just a reference to rust-lang/rust#56254, so that we have all Stacked Borrows issues in one place.
Since that issue was created, I decided to basically give up on two-phase borrows in Stacked Borrows, and treat them like raw pointers. That is the only way I found to accept the safe code allowed by two-phase borrows.
The text was updated successfully, but these errors were encountered: