The borrow checker within

Open link in next tab

The borrow checker within · baby steps

https://smallcultfollowing.com/babysteps/blog/2024/06/02/the-borrow-checker-within/

Sign in to add comment

I’m curious how they plan on implementing interior references while keeping structs that contain them movable and without breaking the “moving structs is always just memcpy” assumption.

All of these would be great to have though, would make the language a lot more ergonomic. I hope they get implemented.

It's mentioned in footnote 6:

As an example, to make this work I’m assuming some kind of “true deref” trait that indicates that Deref yields a reference that remains valid even as the value being deref’d moves from place to place. We need a trait much like this for other reasons too.

It would only work for references that are stable after the value they reference is moved. Think for example of a &str you get from a String.

Didn't read the post yet. But for future reference, posting archived links to posts from that website is probably preferable since it doesn't appear to be hosted in a way that can handle large traffic.

https://web.archive.org/web/20240602124317/https://smallcultfollowing.com/babysteps/blog/2024/06/02/the-borrow-checker-within/