News for hackers. Stuff that matters.
Re:Rust Memory Management by Symmetry on Tuesday May 09, 2017 @12:38PM (#14301507)
>Closing a file requires ownership and is actually an RAII action: when the file object itself goes out of scope (which by definition means all extant references have been removed) the handle is closed.

Ah, no wonder I misunderstood then. I'd forgotten that RAII was something Rust had and that feature does very nicely explain that design decision.

I suppose the reason a Vec doesn't implement Copy then is that its members might not, like a file handle?

Re:Rust Memory Management by masklinn on Tuesday May 09, 2017 @12:45PM (#14301592)
> I suppose the reason a Vec doesn't implement Copy then is that its members might not, like a file handle?

That is correct, Vec has a pointer to a heap allocated buffer, meaning if Vec were Copy, you'd get two Vec structures for the same backing buffer and that's a recipe for disaster.