@@ -4,7 +4,7 @@ use std::iter::once;
4
4
use rustc_arena:: { DroplessArena , TypedArena } ;
5
5
use rustc_data_structures:: captures:: Captures ;
6
6
use rustc_hir:: def_id:: DefId ;
7
- use rustc_hir:: { HirId , RangeEnd } ;
7
+ use rustc_hir:: HirId ;
8
8
use rustc_index:: Idx ;
9
9
use rustc_index:: IndexVec ;
10
10
use rustc_middle:: middle:: stability:: EvalResult ;
@@ -18,12 +18,13 @@ use rustc_target::abi::{FieldIdx, Integer, VariantIdx, FIRST_VARIANT};
18
18
use smallvec:: SmallVec ;
19
19
20
20
use crate :: constructor:: {
21
- IntRange , MaybeInfiniteInt , OpaqueId , Slice , SliceKind , VariantVisibility ,
21
+ IntRange , MaybeInfiniteInt , OpaqueId , RangeEnd , Slice , SliceKind , VariantVisibility ,
22
22
} ;
23
23
use crate :: MatchCx ;
24
24
25
25
use crate :: constructor:: Constructor :: * ;
26
26
27
+ // Re-export rustc-specific versions of all these types.
27
28
pub type Constructor < ' p , ' tcx > = crate :: constructor:: Constructor < RustcCtxt < ' p , ' tcx > > ;
28
29
pub type ConstructorSet < ' p , ' tcx > = crate :: constructor:: ConstructorSet < RustcCtxt < ' p , ' tcx > > ;
29
30
pub type DeconstructedPat < ' p , ' tcx > = crate :: pat:: DeconstructedPat < ' p , RustcCtxt < ' p , ' tcx > > ;
@@ -520,12 +521,16 @@ impl<'p, 'tcx> RustcCtxt<'p, 'tcx> {
520
521
}
521
522
PatKind :: Range ( patrange) => {
522
523
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
+ } ;
523
528
let ty = pat. ty ;
524
529
ctor = match ty. kind ( ) {
525
530
ty:: Char | ty:: Int ( _) | ty:: Uint ( _) => {
526
531
let lo = cx. lower_pat_range_bdy ( * lo, ty) ;
527
532
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) )
529
534
}
530
535
ty:: Float ( fty) => {
531
536
use rustc_apfloat:: Float ;
@@ -536,13 +541,13 @@ impl<'p, 'tcx> RustcCtxt<'p, 'tcx> {
536
541
use rustc_apfloat:: ieee:: Single ;
537
542
let lo = lo. map ( Single :: from_bits) . unwrap_or ( -Single :: INFINITY ) ;
538
543
let hi = hi. map ( Single :: from_bits) . unwrap_or ( Single :: INFINITY ) ;
539
- F32Range ( lo, hi, * end)
544
+ F32Range ( lo, hi, end)
540
545
}
541
546
ty:: FloatTy :: F64 => {
542
547
use rustc_apfloat:: ieee:: Double ;
543
548
let lo = lo. map ( Double :: from_bits) . unwrap_or ( -Double :: INFINITY ) ;
544
549
let hi = hi. map ( Double :: from_bits) . unwrap_or ( Double :: INFINITY ) ;
545
- F64Range ( lo, hi, * end)
550
+ F64Range ( lo, hi, end)
546
551
}
547
552
}
548
553
}
@@ -634,7 +639,7 @@ impl<'p, 'tcx> RustcCtxt<'p, 'tcx> {
634
639
PatKind :: Constant { value }
635
640
} else {
636
641
// We convert to an inclusive range for diagnostics.
637
- let mut end = RangeEnd :: Included ;
642
+ let mut end = rustc_hir :: RangeEnd :: Included ;
638
643
let mut lo = cx. hoist_pat_range_bdy ( range. lo , ty) ;
639
644
if matches ! ( lo, PatRangeBoundary :: PosInfinity ) {
640
645
// The only reason to get `PosInfinity` here is the special case where
@@ -648,7 +653,7 @@ impl<'p, 'tcx> RustcCtxt<'p, 'tcx> {
648
653
}
649
654
let hi = if matches ! ( range. hi, Finite ( 0 ) ) {
650
655
// 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 ;
652
657
range. hi
653
658
} else {
654
659
range. hi . minus_one ( )
@@ -853,6 +858,7 @@ impl<'p, 'tcx> MatchCx for RustcCtxt<'p, 'tcx> {
853
858
type Span = Span ;
854
859
type VariantIdx = VariantIdx ;
855
860
type StrLit = Const < ' tcx > ;
861
+ type ArmData = HirId ;
856
862
857
863
fn is_exhaustive_patterns_feature_on ( & self ) -> bool {
858
864
self . tcx . features ( ) . exhaustive_patterns
0 commit comments