You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! https://perso.crans.org/vanille/treebor has been really useful for my understanding of the Tree Borrows model and for quickly referencing certain aspects. Thank you for this!
When reading the section on interior mutability and the summmary, I could not find anything indicating that shared references with interior mutability don't have protectors added (although I may have missed a detail). In fact, the summary section specifically includes that when entering a function "add a protector to all reference arguments".
Thanks for reporting this, I suppose there is indeed some clarification to be made.
Protectors are bound to tags and are created at the same time as the tag and at no other moment.
So if a reference inherits the tag of its parent it also inherits the protector (or lack thereof) of the parent.
This leads to two symmetrical behaviors not quite captured in "all reference arguments get a protector":
interior mutable shared references get the parent tag and thus have a protector only if the parent does
raw pointers duplicated from references may have a protector if the "parent" pointer (which actually has an identical tag) is protected
I hope this clears the confusion for you right now, I will also think of a way to change the wording of that section to make sure this gets across on the first reading.
Hi! https://perso.crans.org/vanille/treebor has been really useful for my understanding of the Tree Borrows model and for quickly referencing certain aspects. Thank you for this!
When reading the section on interior mutability and the summmary, I could not find anything indicating that shared references with interior mutability don't have protectors added (although I may have missed a detail). In fact, the summary section specifically includes that when entering a function "add a protector to all reference arguments".
However, after further investigation I found that any reference that would keep the tag of its parent pointer does not have a protector added. At least AFAICT from this:
https://github.com/rust-lang/miri/blob/13c915bb42aab8ee4075632e2aff42e95d570b56/src/borrow_tracker/tree_borrows/mod.rs#L157
It seems like there is potential for clarification here?
The text was updated successfully, but these errors were encountered: