New Issue: Memory.Initialization: moveSwap function signature

20334, "benharsh", "Memory.Initialization: moveSwap function signature", "2022-07-29T20:16:10Z"

The current signature of moveSwap is:

proc moveSwap(ref lhs: ?t, ref rhs: t)

There are some minor issues regarding the function signature:

Return Type

We should explicitly state the return type is void.

Formal Names

lhs and rhs Don't really make sense in this context, as they somewhat imply a direction. Rust uses x/y for its swap functions formal names, and C++ uses a/b in std::swap. I propose using x/y.

Error message

We could use a similar tactic as proposed in (#20328) where we have a second generic moveSwap function that accepts fully-generic arguments and issues a compilerError. At this point though, I wonder if we could do something a bit nicer within the compiler itself for trivial cases like X : ?T, Y : T.