@@ -123,7 +123,7 @@ impl Constant {
123123 ( & Self :: Str ( ref ls) , & Self :: Str ( ref rs) ) => Some ( ls. cmp ( rs) ) ,
124124 ( & Self :: Char ( ref l) , & Self :: Char ( ref r) ) => Some ( l. cmp ( r) ) ,
125125 ( & Self :: Int ( l) , & Self :: Int ( r) ) => {
126- if let ty:: Int ( int_ty) = cmp_type. kind {
126+ if let ty:: Int ( int_ty) = * cmp_type. kind ( ) {
127127 Some ( sext ( tcx, l, int_ty) . cmp ( & sext ( tcx, r, int_ty) ) )
128128 } else {
129129 Some ( l. cmp ( & r) )
@@ -162,7 +162,7 @@ pub fn lit_to_constant(lit: &LitKind, ty: Option<Ty<'_>>) -> Constant {
162162 FloatTy :: F32 => Constant :: F32 ( is. as_str ( ) . parse ( ) . unwrap ( ) ) ,
163163 FloatTy :: F64 => Constant :: F64 ( is. as_str ( ) . parse ( ) . unwrap ( ) ) ,
164164 } ,
165- LitKind :: Float ( ref is, LitFloatType :: Unsuffixed ) => match ty. expect ( "type of float is known" ) . kind {
165+ LitKind :: Float ( ref is, LitFloatType :: Unsuffixed ) => match ty. expect ( "type of float is known" ) . kind ( ) {
166166 ty:: Float ( FloatTy :: F32 ) => Constant :: F32 ( is. as_str ( ) . parse ( ) . unwrap ( ) ) ,
167167 ty:: Float ( FloatTy :: F64 ) => Constant :: F64 ( is. as_str ( ) . parse ( ) . unwrap ( ) ) ,
168168 _ => bug ! ( ) ,
@@ -230,7 +230,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
230230 ExprKind :: Array ( ref vec) => self . multi ( vec) . map ( Constant :: Vec ) ,
231231 ExprKind :: Tup ( ref tup) => self . multi ( tup) . map ( Constant :: Tuple ) ,
232232 ExprKind :: Repeat ( ref value, _) => {
233- let n = match self . typeck_results . expr_ty ( e) . kind {
233+ let n = match self . typeck_results . expr_ty ( e) . kind ( ) {
234234 ty:: Array ( _, n) => n. try_eval_usize ( self . lcx . tcx , self . lcx . param_env ) ?,
235235 _ => span_bug ! ( e. span, "typeck error" ) ,
236236 } ;
@@ -281,7 +281,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
281281 Bool ( b) => Some ( Bool ( !b) ) ,
282282 Int ( value) => {
283283 let value = !value;
284- match ty. kind {
284+ match * ty. kind ( ) {
285285 ty:: Int ( ity) => Some ( Int ( unsext ( self . lcx . tcx , value as i128 , ity) ) ) ,
286286 ty:: Uint ( ity) => Some ( Int ( clip ( self . lcx . tcx , value, ity) ) ) ,
287287 _ => None ,
@@ -295,7 +295,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
295295 use self :: Constant :: { Int , F32 , F64 } ;
296296 match * o {
297297 Int ( value) => {
298- let ity = match ty. kind {
298+ let ity = match * ty. kind ( ) {
299299 ty:: Int ( ity) => ity,
300300 _ => return None ,
301301 } ;
@@ -402,7 +402,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
402402 let l = self . expr ( left) ?;
403403 let r = self . expr ( right) ;
404404 match ( l, r) {
405- ( Constant :: Int ( l) , Some ( Constant :: Int ( r) ) ) => match self . typeck_results . expr_ty_opt ( left) ?. kind {
405+ ( Constant :: Int ( l) , Some ( Constant :: Int ( r) ) ) => match * self . typeck_results . expr_ty_opt ( left) ?. kind ( ) {
406406 ty:: Int ( ity) => {
407407 let l = sext ( self . lcx . tcx , l, ity) ;
408408 let r = sext ( self . lcx . tcx , r, ity) ;
@@ -495,7 +495,7 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
495495 use rustc_middle:: mir:: interpret:: { ConstValue , Scalar } ;
496496 match result. val {
497497 ty:: ConstKind :: Value ( ConstValue :: Scalar ( Scalar :: Raw { data : d, .. } ) ) => {
498- match result. ty . kind {
498+ match result. ty . kind ( ) {
499499 ty:: Bool => Some ( Constant :: Bool ( d == 1 ) ) ,
500500 ty:: Uint ( _) | ty:: Int ( _) => Some ( Constant :: Int ( d) ) ,
501501 ty:: Float ( FloatTy :: F32 ) => Some ( Constant :: F32 ( f32:: from_bits (
@@ -505,7 +505,7 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
505505 d. try_into ( ) . expect ( "invalid f64 bit representation" ) ,
506506 ) ) ) ,
507507 ty:: RawPtr ( type_and_mut) => {
508- if let ty:: Uint ( _) = type_and_mut. ty . kind {
508+ if let ty:: Uint ( _) = type_and_mut. ty . kind ( ) {
509509 return Some ( Constant :: RawPtr ( d) ) ;
510510 }
511511 None
@@ -514,8 +514,8 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
514514 _ => None ,
515515 }
516516 } ,
517- ty:: ConstKind :: Value ( ConstValue :: Slice { data, start, end } ) => match result. ty . kind {
518- ty:: Ref ( _, tam, _) => match tam. kind {
517+ ty:: ConstKind :: Value ( ConstValue :: Slice { data, start, end } ) => match result. ty . kind ( ) {
518+ ty:: Ref ( _, tam, _) => match tam. kind ( ) {
519519 ty:: Str => String :: from_utf8 (
520520 data. inspect_with_uninit_and_ptr_outside_interpreter ( start..end)
521521 . to_owned ( ) ,
@@ -526,8 +526,8 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
526526 } ,
527527 _ => None ,
528528 } ,
529- ty:: ConstKind :: Value ( ConstValue :: ByRef { alloc, offset : _ } ) => match result. ty . kind {
530- ty:: Array ( sub_type, len) => match sub_type. kind {
529+ ty:: ConstKind :: Value ( ConstValue :: ByRef { alloc, offset : _ } ) => match result. ty . kind ( ) {
530+ ty:: Array ( sub_type, len) => match sub_type. kind ( ) {
531531 ty:: Float ( FloatTy :: F32 ) => match miri_to_const ( len) {
532532 Some ( Constant :: Int ( len) ) => alloc
533533 . inspect_with_uninit_and_ptr_outside_interpreter ( 0 ..( 4 * len as usize ) )
0 commit comments