@@ -20,7 +20,7 @@ use rustc_span::{Pos, Span};
2020use rustc_target:: abi:: { Align , HasDataLayout , LayoutOf , Size , TargetDataLayout } ;
2121
2222use super :: {
23- Immediate , MPlaceTy , Machine , MemPlace , MemPlaceMeta , Memory , OpTy , Operand , Place , PlaceTy ,
23+ Immediate , MPlaceTy , Machine , MemPlace , MemPlaceMeta , Memory , Operand , Place , PlaceTy ,
2424 ScalarMaybeUninit , StackPopJump ,
2525} ;
2626use crate :: transform:: validate:: equal_up_to_regions;
@@ -875,32 +875,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
875875 Ok ( ( ) )
876876 }
877877
878- pub ( super ) fn const_eval (
879- & self ,
880- gid : GlobalId < ' tcx > ,
881- ty : Ty < ' tcx > ,
882- ) -> InterpResult < ' tcx , OpTy < ' tcx , M :: PointerTag > > {
883- // For statics we pick `ParamEnv::reveal_all`, because statics don't have generics
884- // and thus don't care about the parameter environment. While we could just use
885- // `self.param_env`, that would mean we invoke the query to evaluate the static
886- // with different parameter environments, thus causing the static to be evaluated
887- // multiple times.
888- let param_env = if self . tcx . is_static ( gid. instance . def_id ( ) ) {
889- ty:: ParamEnv :: reveal_all ( )
890- } else {
891- self . param_env
892- } ;
893- let val = self . tcx . const_eval_global_id ( param_env, gid, Some ( self . tcx . span ) ) ?;
894-
895- // Even though `ecx.const_eval` is called from `const_to_op` we can never have a
896- // recursion deeper than one level, because the `tcx.const_eval` above is guaranteed to not
897- // return `ConstValue::Unevaluated`, which is the only way that `const_to_op` will call
898- // `ecx.const_eval`.
899- let const_ = ty:: Const { val : ty:: ConstKind :: Value ( val) , ty } ;
900- self . const_to_op ( & const_, None )
901- }
902-
903- pub fn const_eval_raw (
878+ pub fn const_eval (
904879 & self ,
905880 gid : GlobalId < ' tcx > ,
906881 ) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
0 commit comments