]> git.lizzy.rs Git - rust.git/blob - src/docs/cast_enum_truncation.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / cast_enum_truncation.txt
1 ### What it does
2 Checks for casts from an enum type to an integral type which will definitely truncate the
3 value.
4
5 ### Why is this bad?
6 The resulting integral value will not match the value of the variant it came from.
7
8 ### Example
9 ```
10 enum E { X = 256 };
11 let _ = E::X as u8;
12 ```