@@ -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 , UserTypeProjection } ;
23+ use rustc_middle:: mir:: { self , ConstantKind , 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 } ;
@@ -646,14 +646,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
646646
647647 let lit_input =
648648 LitToConstInput { lit : & lit. node , ty : self . typeck_results . expr_ty ( expr) , neg } ;
649- match self
650- . tcx
651- . at ( expr. span )
652- . lit_to_const ( lit_input)
653- . map ( mir:: ConstantKind :: Ty )
654- . or_else ( |_| self . tcx . at ( expr. span ) . lit_to_mir_constant ( lit_input) )
655- {
656- Ok ( constant) => self . const_to_pat ( constant, expr. hir_id , lit. span , None ) . kind ,
649+ match self . tcx . at ( expr. span ) . lit_to_const ( lit_input) {
650+ Ok ( constant) => {
651+ self . const_to_pat ( ConstantKind :: Ty ( constant) , expr. hir_id , lit. span , None ) . kind
652+ }
657653 Err ( LitToConstError :: Reported ( _) ) => PatKind :: Wild ,
658654 Err ( LitToConstError :: TypeError ) => bug ! ( "lower_lit: had type error" ) ,
659655 }
0 commit comments