RCArray is unsafe
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Tue Mar 3 09:10:53 PST 2015
On Tuesday, 3 March 2015 at 09:05:46 UTC, Walter Bright wrote:
> On 3/2/2015 9:58 PM, weaselcat wrote:
>> Borrowing 'a' from a struct would make the parent struct
>> immutable during the
>> borrow scope of 'a', I believe.
>
> Right, now consider that struct is a leaf in a complex graph of
> data structures.
Rust has several pointer types, so what is gonna happen depend on
the pointer type. However, either the entry in the graph you have
owns 'a', in which case it can be disabled as only one owner of a
exists, so there is no problem tracking it, or the thing is
borrowed, in which case you can have multiple path to 'a' but you
cannot borrow yourself (unless it is immutable).
More information about the Digitalmars-d
mailing list