Variance subtyping and understanding const vs mut pointers

Or, in textual form, and in this very forum:

  • I've written a shorter version of that post (focusing on variance exclusively) here

The TL,DRs:

  • Variance (and subtyping) is related to "being able to shrink lifetime( parameter)s" – or in some cases (contravariance), expanding lifetime( parameter)s.

  • The interaction between PhantomData and dropck only matters when an unsafe impl<#[may_dangle] …> is used, so it's more of a theoretical curiosity more than a knowledge with actual practical usages :grinning_face_with_smiling_eyes:

3 Likes