File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
compiler/rustc_target/src/abi
src/test/ui/enum-discriminant Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1117,7 +1117,7 @@ impl Niche {
11171117 // In practice this means that enums with `count > 1` are unlikely to claim niche zero, since they have to fit perfectly.
11181118 // If niche zero is already reserved, the selection of bounds are of little interest.
11191119 let move_start = |v : WrappingRange | {
1120- let start = v. start . wrapping_sub ( 1 ) & max_value;
1120+ let start = v. start . wrapping_sub ( count ) & max_value;
11211121 Some ( ( start, Scalar { value, valid_range : v. with_start ( start) } ) )
11221122 } ;
11231123 let move_end = |v : WrappingRange | {
Original file line number Diff line number Diff line change 1+ // run-pass
2+
3+ #[ repr( u32 ) ]
4+ pub enum Foo {
5+ // Greater than or equal to 2
6+ A = 2 ,
7+ }
8+
9+ pub enum Bar {
10+ A ( Foo ) ,
11+ // More than two const variants
12+ B ,
13+ C ,
14+ }
15+
16+ fn main ( ) {
17+ match Bar :: A ( Foo :: A ) {
18+ Bar :: A ( _) => ( ) ,
19+ _ => unreachable ! ( ) ,
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments