Advanced Rust
Q96 / 100

What is the pinning contract and self-referential structs?

Correct! Well done.

Incorrect.

The correct answer is B) Pin<P> guarantees the pointee won't move; self-referential structs (holding pointers to their own fields) require Pin because moving would invalidate the pointer

B

Correct Answer

Pin<P> guarantees the pointee won't move; self-referential structs (holding pointers to their own fields) require Pin because moving would invalidate the pointer

Explanation

Async state machines contain references to their own stack variables. Pin prevents moves after these references are created. unsafe impl Unpin on a self-referential type is unsound.

Progress
96/100