@@ -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 , UserTypeProjection } ;
23
+ use rustc_middle:: mir:: { self , ConstantKind , 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 } ;
@@ -646,14 +646,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
646
646
647
647
let lit_input =
648
648
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
+ }
657
653
Err ( LitToConstError :: Reported ( _) ) => PatKind :: Wild ,
658
654
Err ( LitToConstError :: TypeError ) => bug ! ( "lower_lit: had type error" ) ,
659
655
}
0 commit comments