rust-lang / nomicon

The Dark Arts of Advanced and Unsafe Rust Programming
https://doc.rust-lang.org/nomicon/
Apache License 2.0
1.79k stars 261 forks source link

Does pinning violate the wording in Constructors? #266

Open EvanCarroll opened 3 years ago

EvanCarroll commented 3 years ago

The book says,

Move constructors are meaningless in Rust because we don't enable types to "care" about their location in memory. Every type must be ready for it to be blindly memcopied to somewhere else in memory. This means pure on-the-stack-but- still-movable intrusive linked lists are simply not happening in Rust (safely).

I'm new, but I'm not sure that's correct. Isn't that precisely what pin does?

barrowsys commented 2 years ago

bump

Pin could probably use its own chapter but it should at least be mentioned.

also, this paragraph occurs in Constructors, not Destructors