True. I guess I was thinking less unsafe code as opposed to no unsafe code.


On Tue, Feb 25, 2014 at 4:47 PM, Kevin Ballard <ke...@sb.org> wrote:

> > On Feb 25, 2014, at 4:04 PM, Eric Reed <ecr...@cs.washington.edu> wrote:
> >
> > Would a &mut that could move enable us to write insertion into a
> growable data structure that might reallocate itself without unsafe code?
> Something like OwnedVector.push() for instance.
>
> The problem with that is you need uninitialized memory that you can move
> in to (without running drop glue). I don't see how moving from &mut will
> help. Even if rustc can avoid the drop glue when writing to a &mut that it
> already moved out of, there's no way to construct a pre-moved &mut that
> points to the uninitialized memory (and no way to even create uninitialized
> memory without unsafe).
>
> -Kevin
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to