@@ -16,25 +16,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
16
16
bx : & mut Bx ,
17
17
constant : & mir:: Constant < ' tcx > ,
18
18
) -> 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) )
38
22
}
39
23
40
24
pub fn eval_mir_constant (
0 commit comments