RCArray is unsafe

Seo Sanghyeon via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 3 04:23:23 PST 2015


On Tuesday, 3 March 2015 at 05:12:15 UTC, Walter Bright wrote:
> On 3/2/2015 6:04 PM, weaselcat wrote:
>> On Tuesday, 3 March 2015 at 01:56:09 UTC, Walter Bright wrote:
>>> On 3/2/2015 4:40 PM, deadalnix wrote:
>>>> After moving resources, the previous owner can no longer be 
>>>> used.
>>>
>>> How does that work with the example presented by Marc?
>>
>> He couldn't pass s and a member of s because s is borrowed as 
>> mutable.
>> He would have to pass both as immutable.
>
> A pointer to s could be obtained otherwise and passed.

No. Rust compiler forbids you from obtaining the pointer
otherwise. Namely, it is a compile time error to make an alias of
a mutably borrowed pointer.


More information about the Digitalmars-d mailing list