News for hackers. Stuff that matters.
Re:Type-Level Programming in Rust by kevincox on Monday October 05, 2020 @02:13PM (#24690359)
Generating new structs is free in Rust. There is only cost if you need to send it somewhere and the layout differs from the original.

Since `transmute` will be undefined behaviour if the layout differs you will only be saving cost if you would be invoking undefined behaviour.

I recommend checking the generated asm and reporting a missed-optimization bug if it differs.

There are no comments on this comment yet.