Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/items/enumerations.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ It is an error when two variants share the same discriminant.
```rust,compile_fail
enum SharedDiscriminantError {
SharedA = 1,
SharedB = 1
SharedB = 1,
}

enum SharedDiscriminantError2 {
Zero, // 0
One, // 1
OneToo = 1 // 1 (collision with previous!)
OneToo = 1, // 1 (collision with previous!)
}
```

Expand All @@ -185,14 +185,14 @@ It is also an error to have an unspecified discriminant where the previous discr
#[repr(u8)]
enum OverflowingDiscriminantError {
Max = 255,
MaxPlusOne // Would be 256, but that overflows the enum.
MaxPlusOne, // Would be 256, but that overflows the enum.
}

#[repr(u8)]
enum OverflowingDiscriminantError2 {
MaxMinusOne = 254, // 254
Max, // 255
MaxPlusOne // Would be 256, but that overflows the enum.
MaxPlusOne, // Would be 256, but that overflows the enum.
}
```

Expand Down Expand Up @@ -344,7 +344,7 @@ mac_variant! { E }
enum E {
pub U,
pub(crate) T(u8),
pub(super) T { f: String }
pub(super) T { f: String },
}
```

Expand Down
Loading