@@ -568,7 +568,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
568
568
let is_covering_range = |test_case : & TestCase < ' _ , ' tcx > | {
569
569
test_case. as_range ( ) . is_some_and ( |range| {
570
570
matches ! (
571
- range. contains( value, self . tcx, self . infcx . typing_env( self . param_env ) , ) ,
571
+ range. contains( value, self . tcx, self . typing_env( ) , ) ,
572
572
None | Some ( true )
573
573
)
574
574
} )
@@ -587,7 +587,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
587
587
None
588
588
} else {
589
589
fully_matched = true ;
590
- let bits = value. eval_bits ( self . tcx , self . infcx . typing_env ( self . param_env ) ) ;
590
+ let bits = value. eval_bits ( self . tcx , self . typing_env ( ) ) ;
591
591
Some ( TestBranch :: Constant ( value, bits) )
592
592
}
593
593
}
@@ -597,16 +597,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
597
597
// the values being tested. (This restricts what values can be
598
598
// added to the test by subsequent candidates.)
599
599
fully_matched = false ;
600
- let not_contained = sorted_candidates
601
- . keys ( )
602
- . filter_map ( |br| br. as_constant ( ) )
603
- . copied ( )
604
- . all ( |val| {
605
- matches ! (
606
- range. contains( val, self . tcx, self . infcx. typing_env( self . param_env) , ) ,
607
- Some ( false )
608
- )
609
- } ) ;
600
+ let not_contained =
601
+ sorted_candidates. keys ( ) . filter_map ( |br| br. as_constant ( ) ) . copied ( ) . all (
602
+ |val| {
603
+ matches ! ( range. contains( val, self . tcx, self . typing_env( ) , ) , Some ( false ) )
604
+ } ,
605
+ ) ;
610
606
611
607
not_contained. then ( || {
612
608
// No switch values are contained in the pattern range,
@@ -617,11 +613,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
617
613
618
614
( TestKind :: If , TestCase :: Constant { value } ) => {
619
615
fully_matched = true ;
620
- let value = value
621
- . try_eval_bool ( self . tcx , self . infcx . typing_env ( self . param_env ) )
622
- . unwrap_or_else ( || {
623
- span_bug ! ( test. span, "expected boolean value but got {value:?}" )
624
- } ) ;
616
+ let value = value. try_eval_bool ( self . tcx , self . typing_env ( ) ) . unwrap_or_else ( || {
617
+ span_bug ! ( test. span, "expected boolean value but got {value:?}" )
618
+ } ) ;
625
619
Some ( if value { TestBranch :: Success } else { TestBranch :: Failure } )
626
620
}
627
621
@@ -699,7 +693,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
699
693
fully_matched = false ;
700
694
// If the testing range does not overlap with pattern range,
701
695
// the pattern can be matched only if this test fails.
702
- if !test. overlaps ( pat, self . tcx , self . infcx . typing_env ( self . param_env ) ) ? {
696
+ if !test. overlaps ( pat, self . tcx , self . typing_env ( ) ) ? {
703
697
Some ( TestBranch :: Failure )
704
698
} else {
705
699
None
@@ -708,7 +702,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
708
702
}
709
703
( TestKind :: Range ( range) , & TestCase :: Constant { value } ) => {
710
704
fully_matched = false ;
711
- if !range. contains ( value, self . tcx , self . infcx . typing_env ( self . param_env ) ) ? {
705
+ if !range. contains ( value, self . tcx , self . typing_env ( ) ) ? {
712
706
// `value` is not contained in the testing range,
713
707
// so `value` can be matched only if this test fails.
714
708
Some ( TestBranch :: Failure )
0 commit comments