async-book icon indicating copy to clipboard operation
async-book copied to clipboard

Include info about std’s `pin` macro when talking about stack pinning

Open mathmaster13 opened this issue 1 year ago • 0 comments

In section 4, stack pinning is said to require unsafe, and it talks about the pitfalls that can come from dropping a Pin early. However, with the new pin macro, there is a safe way to pin something to the stack, and the pitfalls the book mentions can be checked by the compiler, since the inner value gets moved into the pin (and so cannot be used after being passed to the macro). It’s a relatively new feature, so even if we can’t replace the existing content, we should probably mention it.

mathmaster13 avatar Mar 15 '23 14:03 mathmaster13