Hello,
I am trying to understand the constraints on splitting borrows.
In the following excerpt from Splitting Borrows - The Rustonomicon
it's pretty clearly hopeless for borrowck to understand disjointness in general container types like a tree, especially if distinct keys actually do map to the same value.
- Spatial Disjointedness is definitely needed for splitting into a
mutable
and(mutable|immutable)
borrow. However, conceptually is being disjointed a pre-requisite for splitting a container for multipleimmutable
borrows? - When can distinct
keys
map to the samevalue
? If keys follow ownership rules then keys should never map to shared resources such that a split borrow violates these rules. An example would help clarify.
Thank you for your time.