Unsound `transmute` in `get` method for type `List`
Closed this issue · 1 comments
shinmao commented
Lines 45 to 53 in e7696aa
The safe method
get
used transmute
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.- Transmute has an overloaded return type. If you do not specify the return type it may produce a surprising type to satisfy inference1.
Footnotes
shinmao commented
TypeId
will make sure the reference use same ABI and have same memory layout. The guarantee is strong enough. I will close the issue.