@@ -4,7 +4,7 @@ use std::iter::once;
44use rustc_arena:: { DroplessArena , TypedArena } ;
55use rustc_data_structures:: captures:: Captures ;
66use rustc_hir:: def_id:: DefId ;
7- use rustc_hir:: { HirId , RangeEnd } ;
7+ use rustc_hir:: HirId ;
88use rustc_index:: Idx ;
99use rustc_index:: IndexVec ;
1010use rustc_middle:: middle:: stability:: EvalResult ;
@@ -18,12 +18,13 @@ use rustc_target::abi::{FieldIdx, Integer, VariantIdx, FIRST_VARIANT};
1818use smallvec:: SmallVec ;
1919
2020use crate :: constructor:: {
21- IntRange , MaybeInfiniteInt , OpaqueId , Slice , SliceKind , VariantVisibility ,
21+ IntRange , MaybeInfiniteInt , OpaqueId , RangeEnd , Slice , SliceKind , VariantVisibility ,
2222} ;
2323use crate :: MatchCx ;
2424
2525use crate :: constructor:: Constructor :: * ;
2626
27+ // Re-export rustc-specific versions of all these types.
2728pub type Constructor < ' p , ' tcx > = crate :: constructor:: Constructor < RustcCtxt < ' p , ' tcx > > ;
2829pub type ConstructorSet < ' p , ' tcx > = crate :: constructor:: ConstructorSet < RustcCtxt < ' p , ' tcx > > ;
2930pub type DeconstructedPat < ' p , ' tcx > = crate :: pat:: DeconstructedPat < ' p , RustcCtxt < ' p , ' tcx > > ;
@@ -520,12 +521,16 @@ impl<'p, 'tcx> RustcCtxt<'p, 'tcx> {
520521 }
521522 PatKind :: Range ( patrange) => {
522523 let PatRange { lo, hi, end, .. } = patrange. as_ref ( ) ;
524+ let end = match end {
525+ rustc_hir:: RangeEnd :: Included => RangeEnd :: Included ,
526+ rustc_hir:: RangeEnd :: Excluded => RangeEnd :: Excluded ,
527+ } ;
523528 let ty = pat. ty ;
524529 ctor = match ty. kind ( ) {
525530 ty:: Char | ty:: Int ( _) | ty:: Uint ( _) => {
526531 let lo = cx. lower_pat_range_bdy ( * lo, ty) ;
527532 let hi = cx. lower_pat_range_bdy ( * hi, ty) ;
528- IntRange ( IntRange :: from_range ( lo, hi, * end) )
533+ IntRange ( IntRange :: from_range ( lo, hi, end) )
529534 }
530535 ty:: Float ( fty) => {
531536 use rustc_apfloat:: Float ;
@@ -536,13 +541,13 @@ impl<'p, 'tcx> RustcCtxt<'p, 'tcx> {
536541 use rustc_apfloat:: ieee:: Single ;
537542 let lo = lo. map ( Single :: from_bits) . unwrap_or ( -Single :: INFINITY ) ;
538543 let hi = hi. map ( Single :: from_bits) . unwrap_or ( Single :: INFINITY ) ;
539- F32Range ( lo, hi, * end)
544+ F32Range ( lo, hi, end)
540545 }
541546 ty:: FloatTy :: F64 => {
542547 use rustc_apfloat:: ieee:: Double ;
543548 let lo = lo. map ( Double :: from_bits) . unwrap_or ( -Double :: INFINITY ) ;
544549 let hi = hi. map ( Double :: from_bits) . unwrap_or ( Double :: INFINITY ) ;
545- F64Range ( lo, hi, * end)
550+ F64Range ( lo, hi, end)
546551 }
547552 }
548553 }
@@ -634,7 +639,7 @@ impl<'p, 'tcx> RustcCtxt<'p, 'tcx> {
634639 PatKind :: Constant { value }
635640 } else {
636641 // We convert to an inclusive range for diagnostics.
637- let mut end = RangeEnd :: Included ;
642+ let mut end = rustc_hir :: RangeEnd :: Included ;
638643 let mut lo = cx. hoist_pat_range_bdy ( range. lo , ty) ;
639644 if matches ! ( lo, PatRangeBoundary :: PosInfinity ) {
640645 // The only reason to get `PosInfinity` here is the special case where
@@ -648,7 +653,7 @@ impl<'p, 'tcx> RustcCtxt<'p, 'tcx> {
648653 }
649654 let hi = if matches ! ( range. hi, Finite ( 0 ) ) {
650655 // The range encodes `..ty::MIN`, so we can't convert it to an inclusive range.
651- end = RangeEnd :: Excluded ;
656+ end = rustc_hir :: RangeEnd :: Excluded ;
652657 range. hi
653658 } else {
654659 range. hi . minus_one ( )
@@ -853,6 +858,7 @@ impl<'p, 'tcx> MatchCx for RustcCtxt<'p, 'tcx> {
853858 type Span = Span ;
854859 type VariantIdx = VariantIdx ;
855860 type StrLit = Const < ' tcx > ;
861+ type ArmData = HirId ;
856862
857863 fn is_exhaustive_patterns_feature_on ( & self ) -> bool {
858864 self . tcx . features ( ) . exhaustive_patterns
0 commit comments