@emersion Playing with rust and pointer arithmetic, what a brave man.
Be careful about offset_of. It will UB, should $field contain any kind of smart pointer, because field access automatically dereferences variables to the struct type.
rip C arrows
This looks great otherwise!!! I'm sure "Beyond Memory Safety with Types (2016)" from @InsanityBit@twitter.com will come in handy!
Good luck!
@emersion Any type that implements Deref (eg Rc, Box, Pin, and references).
ptr2struct.field is desugared to (*ptr2struct).field and there is no ptr2struct->field notation.
@hubert Ah, I see, thanks!
@hubert What is a "smart pointer"? You mean a complicated expression?
I've read "Beyond Memory Safety with Types (2016)", it's interesting but I'll focus on just getting the basics working for now!