Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Traits other than NoCell permit UnsafeCells (#682)
Previously, `FromZeros`, `FromBytes`, and `AsBytes` could not be implemented for types containing `UnsafeCell`s. This is a soundness precondition for some types of reference transmutations (notably transmuting either direction between `&[u8]` and `&T`). However, some of our machinery operates only on values (e.g. `transmute!`), and that machinery should in principle be able to support types which contain `UnsafeCell`s. In this commit, we remove the "no `UnsafeCell`" restriction from `FromZeros`, `FromBytes`, and `AsBytes`. We use the recently-added `NoCell` trait as a bound on individual functions and methods where `UnsafeCell`s would be unsound. This permits some APIs to support `UnsafeCell`s which could not previously support them. Closes #251
- Loading branch information