@@ -568,7 +568,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
568568 let is_covering_range = |test_case : & TestCase < ' _ , ' tcx > | {
569569 test_case. as_range ( ) . is_some_and ( |range| {
570570 matches ! (
571- range. contains( value, self . tcx, self . infcx . typing_env( self . param_env ) , ) ,
571+ range. contains( value, self . tcx, self . typing_env( ) , ) ,
572572 None | Some ( true )
573573 )
574574 } )
@@ -587,7 +587,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
587587 None
588588 } else {
589589 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 ( ) ) ;
591591 Some ( TestBranch :: Constant ( value, bits) )
592592 }
593593 }
@@ -597,16 +597,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
597597 // the values being tested. (This restricts what values can be
598598 // added to the test by subsequent candidates.)
599599 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+ ) ;
610606
611607 not_contained. then ( || {
612608 // No switch values are contained in the pattern range,
@@ -617,11 +613,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
617613
618614 ( TestKind :: If , TestCase :: Constant { value } ) => {
619615 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+ } ) ;
625619 Some ( if value { TestBranch :: Success } else { TestBranch :: Failure } )
626620 }
627621
@@ -699,7 +693,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
699693 fully_matched = false ;
700694 // If the testing range does not overlap with pattern range,
701695 // 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 ( ) ) ? {
703697 Some ( TestBranch :: Failure )
704698 } else {
705699 None
@@ -708,7 +702,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
708702 }
709703 ( TestKind :: Range ( range) , & TestCase :: Constant { value } ) => {
710704 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 ( ) ) ? {
712706 // `value` is not contained in the testing range,
713707 // so `value` can be matched only if this test fails.
714708 Some ( TestBranch :: Failure )
0 commit comments