@@ -40,31 +40,26 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
4040        & mut  self , 
4141        constant :  & mir:: Constant < ' tcx > , 
4242    )  -> Result < ConstValue < ' tcx > ,  ErrorHandled >  { 
43-         match  constant. literal . val  { 
44-             ty:: ConstKind :: Unevaluated ( def_id,  substs,  promoted)  => { 
45-                 let  substs = self . monomorphize ( & substs) ; 
46-                 self . cx 
47-                     . tcx ( ) 
48-                     . const_eval_resolve ( ty:: ParamEnv :: reveal_all ( ) ,  def_id,  substs,  promoted,  None ) 
49-                     . map_err ( |err| { 
50-                         if  promoted. is_none ( )  { 
51-                             self . cx 
52-                                 . tcx ( ) 
53-                                 . sess 
54-                                 . span_err ( constant. span ,  "erroneous constant encountered" ) ; 
55-                         } 
56-                         err
57-                     } ) 
58-             } 
43+         match  self . monomorphize ( & constant. literal ) . val  { 
44+             ty:: ConstKind :: Unevaluated ( def_id,  substs,  promoted)  => self 
45+                 . cx 
46+                 . tcx ( ) 
47+                 . const_eval_resolve ( ty:: ParamEnv :: reveal_all ( ) ,  def_id,  substs,  promoted,  None ) 
48+                 . map_err ( |err| { 
49+                     if  promoted. is_none ( )  { 
50+                         self . cx 
51+                             . tcx ( ) 
52+                             . sess 
53+                             . span_err ( constant. span ,  "erroneous constant encountered" ) ; 
54+                     } 
55+                     err
56+                 } ) , 
5957            ty:: ConstKind :: Value ( value)  => Ok ( value) , 
60-             _ => { 
61-                 let  const_ = self . monomorphize ( & constant. literal ) ; 
62-                 if  let  ty:: ConstKind :: Value ( value)  = const_. val  { 
63-                     Ok ( value) 
64-                 }  else  { 
65-                     span_bug ! ( constant. span,  "encountered bad ConstKind in codegen: {:?}" ,  const_) ; 
66-                 } 
67-             } 
58+             err => span_bug ! ( 
59+                 constant. span, 
60+                 "encountered bad ConstKind after monomorphizing: {:?}" , 
61+                 err
62+             ) , 
6863        } 
6964    } 
7065
0 commit comments