@@ -124,7 +124,7 @@ impl Constant {
124
124
( & Self :: Str ( ref ls) , & Self :: Str ( ref rs) ) => Some ( ls. cmp ( rs) ) ,
125
125
( & Self :: Char ( ref l) , & Self :: Char ( ref r) ) => Some ( l. cmp ( r) ) ,
126
126
( & Self :: Int ( l) , & Self :: Int ( r) ) => {
127
- if let ty:: Int ( int_ty) = cmp_type. sty {
127
+ if let ty:: Int ( int_ty) = cmp_type. kind {
128
128
Some ( sext ( tcx, l, int_ty) . cmp ( & sext ( tcx, r, int_ty) ) )
129
129
} else {
130
130
Some ( l. cmp ( & r) )
@@ -161,7 +161,7 @@ pub fn lit_to_constant(lit: &LitKind, ty: Ty<'_>) -> Constant {
161
161
LitKind :: ByteStr ( ref s) => Constant :: Binary ( Lrc :: clone ( s) ) ,
162
162
LitKind :: Char ( c) => Constant :: Char ( c) ,
163
163
LitKind :: Int ( n, _) => Constant :: Int ( n) ,
164
- LitKind :: Float ( ref is, _) | LitKind :: FloatUnsuffixed ( ref is) => match ty. sty {
164
+ LitKind :: Float ( ref is, _) | LitKind :: FloatUnsuffixed ( ref is) => match ty. kind {
165
165
ty:: Float ( FloatTy :: F32 ) => Constant :: F32 ( is. as_str ( ) . parse ( ) . unwrap ( ) ) ,
166
166
ty:: Float ( FloatTy :: F64 ) => Constant :: F64 ( is. as_str ( ) . parse ( ) . unwrap ( ) ) ,
167
167
_ => bug ! ( ) ,
@@ -229,7 +229,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
229
229
ExprKind :: Array ( ref vec) => self . multi ( vec) . map ( Constant :: Vec ) ,
230
230
ExprKind :: Tup ( ref tup) => self . multi ( tup) . map ( Constant :: Tuple ) ,
231
231
ExprKind :: Repeat ( ref value, _) => {
232
- let n = match self . tables . expr_ty ( e) . sty {
232
+ let n = match self . tables . expr_ty ( e) . kind {
233
233
ty:: Array ( _, n) => n. eval_usize ( self . lcx . tcx , self . lcx . param_env ) ,
234
234
_ => span_bug ! ( e. span, "typeck error" ) ,
235
235
} ;
@@ -286,7 +286,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
286
286
Bool ( b) => Some ( Bool ( !b) ) ,
287
287
Int ( value) => {
288
288
let value = !value;
289
- match ty. sty {
289
+ match ty. kind {
290
290
ty:: Int ( ity) => Some ( Int ( unsext ( self . lcx . tcx , value as i128 , ity) ) ) ,
291
291
ty:: Uint ( ity) => Some ( Int ( clip ( self . lcx . tcx , value, ity) ) ) ,
292
292
_ => None ,
@@ -300,7 +300,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
300
300
use self :: Constant :: * ;
301
301
match * o {
302
302
Int ( value) => {
303
- let ity = match ty. sty {
303
+ let ity = match ty. kind {
304
304
ty:: Int ( ity) => ity,
305
305
_ => return None ,
306
306
} ;
@@ -378,7 +378,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
378
378
let l = self . expr ( left) ?;
379
379
let r = self . expr ( right) ;
380
380
match ( l, r) {
381
- ( Constant :: Int ( l) , Some ( Constant :: Int ( r) ) ) => match self . tables . expr_ty ( left) . sty {
381
+ ( Constant :: Int ( l) , Some ( Constant :: Int ( r) ) ) => match self . tables . expr_ty ( left) . kind {
382
382
ty:: Int ( ity) => {
383
383
let l = sext ( self . lcx . tcx , l, ity) ;
384
384
let r = sext ( self . lcx . tcx , r, ity) ;
@@ -470,7 +470,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
470
470
pub fn miri_to_const ( result : & ty:: Const < ' _ > ) -> Option < Constant > {
471
471
use rustc:: mir:: interpret:: { ConstValue , Scalar } ;
472
472
match result. val {
473
- ConstValue :: Scalar ( Scalar :: Raw { data : d, .. } ) => match result. ty . sty {
473
+ ConstValue :: Scalar ( Scalar :: Raw { data : d, .. } ) => match result. ty . kind {
474
474
ty:: Bool => Some ( Constant :: Bool ( d == 1 ) ) ,
475
475
ty:: Uint ( _) | ty:: Int ( _) => Some ( Constant :: Int ( d) ) ,
476
476
ty:: Float ( FloatTy :: F32 ) => Some ( Constant :: F32 ( f32:: from_bits (
@@ -480,16 +480,16 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
480
480
d. try_into ( ) . expect ( "invalid f64 bit representation" ) ,
481
481
) ) ) ,
482
482
ty:: RawPtr ( type_and_mut) => {
483
- if let ty:: Uint ( _) = type_and_mut. ty . sty {
483
+ if let ty:: Uint ( _) = type_and_mut. ty . kind {
484
484
return Some ( Constant :: RawPtr ( d) ) ;
485
485
}
486
486
None
487
487
} ,
488
488
// FIXME: implement other conversions.
489
489
_ => None ,
490
490
} ,
491
- ConstValue :: Slice { data, start, end } => match result. ty . sty {
492
- ty:: Ref ( _, tam, _) => match tam. sty {
491
+ ConstValue :: Slice { data, start, end } => match result. ty . kind {
492
+ ty:: Ref ( _, tam, _) => match tam. kind {
493
493
ty:: Str => String :: from_utf8 (
494
494
data. inspect_with_undef_and_ptr_outside_interpreter ( start..end)
495
495
. to_owned ( ) ,
0 commit comments