@@ -58,10 +58,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
5858 kind : TestKind :: Eq { value, ty : match_pair. pattern . ty } ,
5959 } ,
6060
61- PatKind :: Range ( range) => {
61+ PatKind :: Range ( ref range) => {
6262 assert_eq ! ( range. lo. ty( ) , match_pair. pattern. ty) ;
6363 assert_eq ! ( range. hi. ty( ) , match_pair. pattern. ty) ;
64- Test { span : match_pair. pattern . span , kind : TestKind :: Range ( range) }
64+ Test { span : match_pair. pattern . span , kind : TestKind :: Range ( range. clone ( ) ) }
6565 }
6666
6767 PatKind :: Slice { ref prefix, ref slice, ref suffix } => {
@@ -102,9 +102,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
102102 PatKind :: Variant { .. } => {
103103 panic ! ( "you should have called add_variants_to_switch instead!" ) ;
104104 }
105- PatKind :: Range ( range) => {
105+ PatKind :: Range ( ref range) => {
106106 // Check that none of the switch values are in the range.
107- self . values_not_contained_in_range ( range, options) . unwrap_or ( false )
107+ self . values_not_contained_in_range ( & * range, options) . unwrap_or ( false )
108108 }
109109 PatKind :: Slice { .. }
110110 | PatKind :: Array { .. }
@@ -272,7 +272,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
272272 }
273273 }
274274
275- TestKind :: Range ( PatRange { lo, hi, ref end } ) => {
275+ TestKind :: Range ( box PatRange { lo, hi, ref end } ) => {
276276 let lower_bound_success = self . cfg . start_new_block ( ) ;
277277 let target_blocks = make_target_blocks ( self ) ;
278278
@@ -540,9 +540,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
540540 Some ( index)
541541 }
542542
543- ( & TestKind :: SwitchInt { switch_ty : _, ref options } , & PatKind :: Range ( range) ) => {
543+ ( & TestKind :: SwitchInt { switch_ty : _, ref options } , & PatKind :: Range ( ref range) ) => {
544544 let not_contained =
545- self . values_not_contained_in_range ( range, options) . unwrap_or ( false ) ;
545+ self . values_not_contained_in_range ( & * range, options) . unwrap_or ( false ) ;
546546
547547 if not_contained {
548548 // No switch values are contained in the pattern range,
@@ -631,7 +631,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
631631 }
632632 }
633633
634- ( & TestKind :: Range ( test) , & PatKind :: Range ( pat) ) => {
634+ ( & TestKind :: Range ( ref test) , & PatKind :: Range ( ref pat) ) => {
635635 use std:: cmp:: Ordering :: * ;
636636
637637 if test == pat {
@@ -658,8 +658,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
658658 no_overlap
659659 }
660660
661- ( & TestKind :: Range ( range) , & PatKind :: Constant { value } ) => {
662- if let Some ( false ) = self . const_range_contains ( range, value) {
661+ ( & TestKind :: Range ( ref range) , & PatKind :: Constant { value } ) => {
662+ if let Some ( false ) = self . const_range_contains ( & * range, value) {
663663 // `value` is not contained in the testing range,
664664 // so `value` can be matched only if this test fails.
665665 Some ( 1 )
@@ -754,7 +754,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
754754
755755 fn const_range_contains (
756756 & self ,
757- range : PatRange < ' tcx > ,
757+ range : & PatRange < ' tcx > ,
758758 value : ConstantKind < ' tcx > ,
759759 ) -> Option < bool > {
760760 use std:: cmp:: Ordering :: * ;
@@ -772,7 +772,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
772772
773773 fn values_not_contained_in_range (
774774 & self ,
775- range : PatRange < ' tcx > ,
775+ range : & PatRange < ' tcx > ,
776776 options : & FxIndexMap < ConstantKind < ' tcx > , u128 > ,
777777 ) -> Option < bool > {
778778 for & val in options. keys ( ) {
0 commit comments