I recently ran into an issue where I wanted to use Any for slices. However, it only allows 'static types (based on what I read, this is because you get the same TypeId regardless of lifetimes).
I came up with this workaround which I think is safe:
It seems to pass Miri, including the mut version (which requires a bit more care to ensure there can only be one mutable reference). Any problems with doing this?
Note: both code fragments and links contain things like &
Yes, I know. lemmy mangles stuff like ampersand and less than even inside code blocks. I noted this in an edit for the main post and included a playground link as well.