Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



It 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.


> 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: