@@ -16,25 +16,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1616 bx : & mut Bx ,
1717 constant : & mir:: Constant < ' tcx > ,
1818 ) -> Result < OperandRef < ' tcx , Bx :: Value > , ErrorHandled > {
19- match constant. literal . val {
20- // Special case unevaluated statics, because statics have an identity and thus should
21- // use `get_static` to get at their id.
22- // FIXME(oli-obk): can we unify this somehow, maybe by making const eval of statics
23- // always produce `&STATIC`. This may also simplify how const eval works with statics.
24- ty:: ConstKind :: Unevaluated ( def_id, substs, None ) if self . cx . tcx ( ) . is_static ( def_id) => {
25- assert ! ( substs. is_empty( ) , "we don't support generic statics yet" ) ;
26- let static_ = bx. get_static ( def_id) ;
27- // we treat operands referring to statics as if they were `&STATIC` instead
28- let ptr_ty = self . cx . tcx ( ) . mk_mut_ptr ( self . monomorphize ( & constant. literal . ty ) ) ;
29- let layout = bx. layout_of ( ptr_ty) ;
30- Ok ( OperandRef :: from_immediate_or_packed_pair ( bx, static_, layout) )
31- }
32- _ => {
33- let val = self . eval_mir_constant ( constant) ?;
34- let ty = self . monomorphize ( & constant. literal . ty ) ;
35- Ok ( OperandRef :: from_const ( bx, val, ty) )
36- }
37- }
19+ let val = self . eval_mir_constant ( constant) ?;
20+ let ty = self . monomorphize ( & constant. literal . ty ) ;
21+ Ok ( OperandRef :: from_const ( bx, val, ty) )
3822 }
3923
4024 pub fn eval_mir_constant (
0 commit comments