@@ -85,7 +85,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
85
85
test_place : & PlaceBuilder < ' tcx > ,
86
86
candidate : & Candidate < ' pat , ' tcx > ,
87
87
switch_ty : Ty < ' tcx > ,
88
- options : & mut FxIndexMap < & ' tcx ty :: Const < ' tcx > , u128 > ,
88
+ options : & mut FxIndexMap < ConstantKind < ' tcx > , u128 > ,
89
89
) -> bool {
90
90
let match_pair = match candidate. match_pairs . iter ( ) . find ( |mp| mp. place == * test_place) {
91
91
Some ( match_pair) => match_pair,
@@ -262,7 +262,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
262
262
ty,
263
263
) ;
264
264
} else if let [ success, fail] = * make_target_blocks ( self ) {
265
- assert_eq ! ( value. ty, ty) ;
265
+ assert_eq ! ( value. ty( ) , ty) ;
266
266
let expect = self . literal_operand ( test. span , value) ;
267
267
let val = Operand :: Copy ( place) ;
268
268
self . compare ( block, success, fail, source_info, BinOp :: Eq , expect, val) ;
@@ -364,7 +364,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
364
364
block : BasicBlock ,
365
365
make_target_blocks : impl FnOnce ( & mut Self ) -> Vec < BasicBlock > ,
366
366
source_info : SourceInfo ,
367
- value : & ' tcx ty :: Const < ' tcx > ,
367
+ value : ConstantKind < ' tcx > ,
368
368
place : Place < ' tcx > ,
369
369
mut ty : Ty < ' tcx > ,
370
370
) {
@@ -385,7 +385,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
385
385
_ => None ,
386
386
} ;
387
387
let opt_ref_ty = unsize ( ty) ;
388
- let opt_ref_test_ty = unsize ( value. ty ) ;
388
+ let opt_ref_test_ty = unsize ( value. ty ( ) ) ;
389
389
match ( opt_ref_ty, opt_ref_test_ty) {
390
390
// nothing to do, neither is an array
391
391
( None , None ) => { }
@@ -773,16 +773,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
773
773
fn const_range_contains (
774
774
& self ,
775
775
range : PatRange < ' tcx > ,
776
- value : & ' tcx ty :: Const < ' tcx > ,
776
+ value : ConstantKind < ' tcx > ,
777
777
) -> Option < bool > {
778
778
use std:: cmp:: Ordering :: * ;
779
779
780
780
let tcx = self . tcx ;
781
781
782
- let lo = ty :: Const :: from_value ( tcx , ConstValue :: Scalar ( range. lo . into ( ) ) , value. ty ) ;
783
- let hi = ty :: Const :: from_value ( tcx , ConstValue :: Scalar ( range. hi . into ( ) ) , value. ty ) ;
784
- let a = compare_const_vals ( tcx, lo, value, self . param_env , value. ty ) ?;
785
- let b = compare_const_vals ( tcx, value, hi, self . param_env , value. ty ) ?;
782
+ let lo = ConstantKind :: Val ( ConstValue :: Scalar ( range. lo . into ( ) ) , value. ty ( ) ) ;
783
+ let hi = ConstantKind :: Val ( ConstValue :: Scalar ( range. hi . into ( ) ) , value. ty ( ) ) ;
784
+ let a = compare_const_vals ( tcx, lo, value, self . param_env , value. ty ( ) ) ?;
785
+ let b = compare_const_vals ( tcx, value, hi, self . param_env , value. ty ( ) ) ?;
786
786
787
787
match ( b, range. end ) {
788
788
( Less , _) | ( Equal , RangeEnd :: Included ) if a != Greater => Some ( true ) ,
@@ -793,7 +793,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
793
793
fn values_not_contained_in_range (
794
794
& self ,
795
795
range : PatRange < ' tcx > ,
796
- options : & FxIndexMap < & ' tcx ty :: Const < ' tcx > , u128 > ,
796
+ options : & FxIndexMap < ConstantKind < ' tcx > , u128 > ,
797
797
) -> Option < bool > {
798
798
for & val in options. keys ( ) {
799
799
if self . const_range_contains ( range, val) ? {
0 commit comments