Open Imberflur opened 10 months ago
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":
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?