Skip to content

MaybeUninit impls are unsound #299

@joshlf

Description

@joshlf

Since FromZeroes and FromBytes ban UnsafeCells, and since rust-lang/unsafe-code-guidelines#455 implies that there's no way to "disable" interior mutability, our impls of FromZeroes and FromBytes for MaybeUninit<T> with no bounds on T are unsound. See also this discussion.

One option we may want to consider is introducing a NoCell trait that is a super-trait of all of our traits (other than Unaligned) so that we can do e.g. impl<T: NoCell> FromBytes for MaybeUninit<T>.

A note on semver: When releasing this, it's doubtful that anyone is relying on this behavior. We may want to just release 0.7.X (whatever the next patch version is at the time of releasing) and yank the previous 0.7.Y versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocking-next-releaseThis issue should be resolved before we release on crates.iocompatibility-breakingChanges that are (likely to be) breaking

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions