File tree 1 file changed +3
-4
lines changed
compiler/rustc_mir_build/src/thir/pattern 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -1485,9 +1485,7 @@ fn all_constructors<'a, 'tcx>(
1485
1485
)
1486
1486
} ;
1487
1487
match * pcx. ty . kind ( ) {
1488
- ty:: Bool => {
1489
- [ true , false ] . iter ( ) . map ( |& b| ConstantValue ( ty:: Const :: from_bool ( cx. tcx , b) ) ) . collect ( )
1490
- }
1488
+ ty:: Bool => vec ! [ make_range( 0 , 1 ) ] ,
1491
1489
ty:: Array ( ref sub_ty, len) if len. try_eval_usize ( cx. tcx , cx. param_env ) . is_some ( ) => {
1492
1490
let len = len. eval_usize ( cx. tcx , cx. param_env ) ;
1493
1491
if len != 0 && cx. is_uninhabited ( sub_ty) {
@@ -1600,7 +1598,7 @@ impl<'tcx> IntRange<'tcx> {
1600
1598
#[ inline]
1601
1599
fn is_integral ( ty : Ty < ' _ > ) -> bool {
1602
1600
match ty. kind ( ) {
1603
- ty:: Char | ty:: Int ( _) | ty:: Uint ( _) => true ,
1601
+ ty:: Char | ty:: Int ( _) | ty:: Uint ( _) | ty :: Bool => true ,
1604
1602
_ => false ,
1605
1603
}
1606
1604
}
@@ -1622,6 +1620,7 @@ impl<'tcx> IntRange<'tcx> {
1622
1620
#[ inline]
1623
1621
fn integral_size_and_signed_bias ( tcx : TyCtxt < ' tcx > , ty : Ty < ' _ > ) -> Option < ( Size , u128 ) > {
1624
1622
match * ty. kind ( ) {
1623
+ ty:: Bool => Some ( ( Size :: from_bytes ( 1 ) , 0 ) ) ,
1625
1624
ty:: Char => Some ( ( Size :: from_bytes ( 4 ) , 0 ) ) ,
1626
1625
ty:: Int ( ity) => {
1627
1626
let size = Integer :: from_attr ( & tcx, SignedInt ( ity) ) . size ( ) ;
You can’t perform that action at this time.
0 commit comments