@@ -20,7 +20,7 @@ use rustc_index::Idx;
2020use rustc_middle:: mir:: interpret:: {
2121 ConstValue , ErrorHandled , GlobalId , LitToConstError , LitToConstInput , Scalar ,
2222} ;
23- use rustc_middle:: mir:: { self , ConstantKind , UserTypeProjection } ;
23+ use rustc_middle:: mir:: { self , UserTypeProjection } ;
2424use rustc_middle:: mir:: { BorrowKind , Mutability } ;
2525use rustc_middle:: thir:: { Ascription , BindingMode , FieldPat , LocalVarId , Pat , PatKind , PatRange } ;
2626use rustc_middle:: ty:: subst:: { GenericArg , SubstsRef } ;
@@ -525,7 +525,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
525525 . tcx
526526 . const_eval_global_id_for_typeck ( param_env_reveal_all, cid, Some ( span) )
527527 . map ( |val| match val {
528- Some ( valtree) => mir :: ConstantKind :: Ty ( self . tcx . mk_const ( valtree, ty) ) ,
528+ Some ( valtree) => self . tcx . mk_const ( valtree, ty) . into ( ) ,
529529 None => mir:: ConstantKind :: Val (
530530 self . tcx
531531 . const_eval_global_id ( param_env_reveal_all, cid, Some ( span) )
@@ -608,7 +608,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
608608 } ;
609609 if let Some ( lit_input) = lit_input {
610610 match tcx. at ( expr. span ) . lit_to_const ( lit_input) {
611- Ok ( c) => return self . const_to_pat ( ConstantKind :: Ty ( c ) , id, span, None ) . kind ,
611+ Ok ( c) => return self . const_to_pat ( c . into ( ) , id, span, None ) . kind ,
612612 // If an error occurred, ignore that it's a literal
613613 // and leave reporting the error up to const eval of
614614 // the unevaluated constant below.
@@ -631,7 +631,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
631631 if let Ok ( Some ( valtree) ) =
632632 self . tcx . const_eval_resolve_for_typeck ( self . param_env , ct, Some ( span) )
633633 {
634- self . const_to_pat ( ConstantKind :: Ty ( self . tcx . mk_const ( valtree, ty) ) , id, span, None ) . kind
634+ self . const_to_pat ( self . tcx . mk_const ( valtree, ty) . into ( ) , id, span, None ) . kind
635635 } else {
636636 // If that fails, convert it to an opaque constant pattern.
637637 match tcx. const_eval_resolve ( self . param_env , uneval, None ) {
@@ -671,9 +671,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
671671 let lit_input =
672672 LitToConstInput { lit : & lit. node , ty : self . typeck_results . expr_ty ( expr) , neg } ;
673673 match self . tcx . at ( expr. span ) . lit_to_const ( lit_input) {
674- Ok ( constant) => {
675- self . const_to_pat ( ConstantKind :: Ty ( constant) , expr. hir_id , lit. span , None ) . kind
676- }
674+ Ok ( constant) => self . const_to_pat ( constant. into ( ) , expr. hir_id , lit. span , None ) . kind ,
677675 Err ( LitToConstError :: Reported ( _) ) => PatKind :: Wild ,
678676 Err ( LitToConstError :: TypeError ) => bug ! ( "lower_lit: had type error" ) ,
679677 }
0 commit comments