@@ -20,7 +20,7 @@ use rustc_index::Idx;
20
20
use rustc_middle:: mir:: interpret:: {
21
21
ConstValue , ErrorHandled , GlobalId , LitToConstError , LitToConstInput , Scalar ,
22
22
} ;
23
- use rustc_middle:: mir:: { self , ConstantKind , UserTypeProjection } ;
23
+ use rustc_middle:: mir:: { self , UserTypeProjection } ;
24
24
use rustc_middle:: mir:: { BorrowKind , Mutability } ;
25
25
use rustc_middle:: thir:: { Ascription , BindingMode , FieldPat , LocalVarId , Pat , PatKind , PatRange } ;
26
26
use rustc_middle:: ty:: subst:: { GenericArg , SubstsRef } ;
@@ -525,7 +525,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
525
525
. tcx
526
526
. const_eval_global_id_for_typeck ( param_env_reveal_all, cid, Some ( span) )
527
527
. 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 ( ) ,
529
529
None => mir:: ConstantKind :: Val (
530
530
self . tcx
531
531
. const_eval_global_id ( param_env_reveal_all, cid, Some ( span) )
@@ -608,7 +608,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
608
608
} ;
609
609
if let Some ( lit_input) = lit_input {
610
610
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 ,
612
612
// If an error occurred, ignore that it's a literal
613
613
// and leave reporting the error up to const eval of
614
614
// the unevaluated constant below.
@@ -631,7 +631,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
631
631
if let Ok ( Some ( valtree) ) =
632
632
self . tcx . const_eval_resolve_for_typeck ( self . param_env , ct, Some ( span) )
633
633
{
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
635
635
} else {
636
636
// If that fails, convert it to an opaque constant pattern.
637
637
match tcx. const_eval_resolve ( self . param_env , uneval, None ) {
@@ -671,9 +671,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
671
671
let lit_input =
672
672
LitToConstInput { lit : & lit. node , ty : self . typeck_results . expr_ty ( expr) , neg } ;
673
673
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 ,
677
675
Err ( LitToConstError :: Reported ( _) ) => PatKind :: Wild ,
678
676
Err ( LitToConstError :: TypeError ) => bug ! ( "lower_lit: had type error" ) ,
679
677
}
0 commit comments