Stream: project-safe-transmute

Topic: Another use for `NoUndef`


scottmcm (May 07 2020 at 03:05, on Zulip):

I was pondering the bitwise-ness of Copy, and this got me thinking about match and Eq, where one way to allow more things in patterns would be to require that they're bitwise-comparable for Eq. But I think that the only way that could be sound at the aggregate level (as opposed to field-by-field) would be if it contained no undef, which I think is one of the markers you're pondering here as a requirement for safe &T->&[u8].

Hmm, trying to find the attribute for it got me to https://github.com/rust-lang/rust/issues/63438 (which removed said attribute), which has some similar thoughts in it.

Lokathor (May 07 2020 at 03:56, on Zulip):

So you want to match on two values being equal without them being the same type?

scottmcm (May 09 2020 at 19:54, on Zulip):

I was thinking more of being able to memcmp them (of the same type) instead of needing to Eq::eq, like how Copy lets me memcpy instead of Clone::clone.

Last update: Jun 05 2020 at 23:15UTC