Commit 7dbd5bb 1 parent cd8b56f commit 7dbd5bb Copy full SHA for 7dbd5bb
File tree 2 files changed +22
-1
lines changed
compiler/rustc_target/src/abi
src/test/ui/enum-discriminant
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1117,7 +1117,7 @@ impl Niche {
1117
1117
// In practice this means that enums with `count > 1` are unlikely to claim niche zero, since they have to fit perfectly.
1118
1118
// If niche zero is already reserved, the selection of bounds are of little interest.
1119
1119
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;
1121
1121
Some ( ( start, Scalar { value, valid_range : v. with_start ( start) } ) )
1122
1122
} ;
1123
1123
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