3 ms·
I'm not saying a theoretical language couldn't be made that allows this, but in Rust it would be breaking backwards compatibility. For example [T]::sort (obvio
by orlp 3y ago
I'm not saying a theoretical language couldn't be made that allows this, but in Rust it would be breaking backwards compatibility.
For example [T]::sort (obviously) needs to be able to move the elements in the passed array, but there is no Move bound on T or something similar.
> It basically does if you use pin.
And we have Pin today, but I assumed the OP meant 'self-referential struct' as in, without using Pin.
- nu11ptr 3y ago> And we have Pin today, but I assumed the OP meant 'self-referential struct' as in, without using Pin. I did, but with Pin would be fine as well
- devit 3y agoIt would have to be introduced by making it default, so all existing generic items would have Move bound on all generic parameters. Only in a new edition the default can then be swapped.