Closed shinmao closed 1 year ago
https://github.com/r3-os/r3/blob/e7696aa1d66aa74a935b31bb894e1f274bcc4206/src/r3_core/src/bag.rs#L45-L53 The safe method get used transmute to make conversion from &Head to &T. Here are two problems:
get
transmute
&Head
&T
Copy
TypeId will make sure the reference use same ABI and have same memory layout. The guarantee is strong enough. I will close the issue.
TypeId
https://github.com/r3-os/r3/blob/e7696aa1d66aa74a935b31bb894e1f274bcc4206/src/r3_core/src/bag.rs#L45-L53 The safe method
get
usedtransmute
to make conversion from&Head
to&T
. Here are two problems:Copy
trait bound is not sufficient for us to safely transmute from&Head
. Suggest to use trait bound such as Pod.