+ pub(super) fn const_eval(
+ &self,
+ gid: GlobalId<'tcx>,
+ ) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>> {
+ // For statics we pick `ParamEnv::reveal_all`, because statics don't have generics
+ // and thus don't care about the parameter environment. While we could just use
+ // `self.param_env`, that would mean we invoke the query to evaluate the static
+ // with different parameter environments, thus causing the static to be evaluated
+ // multiple times.
+ let param_env = if self.tcx.is_static(gid.instance.def_id()) {
+ ty::ParamEnv::reveal_all()
+ } else {
+ self.param_env
+ };
+ let val = self.tcx.const_eval(param_env.and(gid))?;
+ self.eval_const_to_op(val, None)
+ }
+