Skip to content

Commit 57e8b93

Browse files
authored
[derive] Clarify FromBytes enum support (#2696)
We previously incorrectly said that we supported `FromBytes` on enums with `repr`s larger than `u16`/`i16`, which we don't. Closes #2654
1 parent ca8f52f commit 57e8b93

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3398,11 +3398,10 @@ pub unsafe trait FromZeros: TryFromBytes {
33983398
///
33993399
/// - If the type is a struct, all of its fields must be `FromBytes`.
34003400
/// - If the type is an enum:
3401-
/// - It must have a defined representation (`repr`s `u8`, `u16`, `u32`,
3402-
/// `u64`, `usize`, `i8`, `i16`, `i32`, `i64`, or `isize`).
3401+
/// - It must have a defined representation which is one of `u8`, `u16`, `i8`,
3402+
/// or `i16`.
34033403
/// - The maximum number of discriminants must be used (so that every possible
3404-
/// bit pattern is a valid one). Be very careful when using the `usize` or
3405-
/// `isize` representations, as their size is platform-dependent.
3404+
/// bit pattern is a valid one).
34063405
/// - Its fields must be `FromBytes`.
34073406
///
34083407
/// This analysis is subject to change. Unsafe code may *only* rely on the

0 commit comments

Comments
 (0)