Edit: Maybe instead of having two traits DynMove: DynSized and Move: DynMove + Sized, there could be a single trait Move: DynSized. Pro: One less trait to worry about. Con: The fully explicit bound that used to be T: Move becomes T: Move + Sized. This only really affects traits, and it would still be equivalent to T: Sized, but it means you need two (usually implicit) bounds to be able to statically move something.
One way to reconcile the two worlds:
- Split
DynSizedintoDynSizedandDynMove: DynSized, with every aspect of theDynSizedproposal replicated for each. UseDynSizedto constrainsize_of_val, and useDynMovepretty much everywhere else. Immovable types become!DynMove. - Introduce
Move: DynMove + Sized. -
Sizedremains a default bound.Moveis a default bound for allTwhereT: Sized(explicitly or by default), includingSelf. This is so that an explicitSelf: Sizedbound impliesSelf: Move(otherwise most code that does this would break). -
?Sizedremoves theMovedefault bound as well, which follows from the previous point. This means that immovable types work with all existing?Sizedtype parameters, and most code using immovable types will continue to use a?Sizedbound. - Anything other than
Selfthat wants to work specifically with sized but potentially immovable types can switch to?Move, which is not compatible with?Sizedcallers, requiring migration anywhere this applies. - To have a sized but potentially immovable
Self, you needSelf: ?Move + Sized. This follows the pattern ofSelfneeding to beSelf: [constraints] + Sizedin order to have the same constraints as another type parameterT: [constraints].
Pro: Sized and Move are retained as distinct properties.
Con: Sized implying Move by default in traits is a bit weird… and we were worried about the original proposal being hackish
. This could at least be mitigated by adding a warning recommending these instances migrate to having explicit Move/?Move+Sized bounds instead, at the cost of increasing the encouraged migration footprint.
Re whether this is on topic: yeah, oops. Though, technically, the topic is about Pin owning the pinned value. One way would be with &move and PinMove, and another would be with !Move and Pinned, so… 