Skip to content

Commit

Permalink
Traits other than NoCell permit UnsafeCells
Browse files Browse the repository at this point in the history
TODO:
- Require `T: NoCell` and `U: NoCell` in `transmute_ref!` and
  `transmute_mut!`
- Tests
  - Exercise transmuting `UnsafeCell`s by value
- Time to rename `AsBytes` to `ToBytes`?

Closes #251
  • Loading branch information
joshlf committed Dec 7, 2023
1 parent 949c7bb commit 76f7644
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 149 deletions.
4 changes: 2 additions & 2 deletions src/byteorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ mod tests {
use compatibility::*;

// A native integer type (u16, i32, etc).
trait Native: Arbitrary + FromBytes + AsBytes + Copy + PartialEq + Debug {
trait Native: Arbitrary + FromBytes + AsBytes + NoCell + Copy + PartialEq + Debug {
const ZERO: Self;
const MAX_VALUE: Self;

Expand Down Expand Up @@ -692,7 +692,7 @@ mod tests {
}

trait ByteArray:
FromBytes + AsBytes + Copy + AsRef<[u8]> + AsMut<[u8]> + Debug + Default + Eq
FromBytes + AsBytes + NoCell + Copy + AsRef<[u8]> + AsMut<[u8]> + Debug + Default + Eq
{
/// Invert the order of the bytes in the array.
fn invert(self) -> Self;
Expand Down
Loading

0 comments on commit 76f7644

Please sign in to comment.